#include <iostream>
#include <fstream>
#include <cmath>
#include <iomanip>

using namespace std;
ifstream fi("ntcn.inp");
ofstream fo("ntcn.out");
int n,a[100000];

doc()
{
    fi >> n;
    for (int i = 0; i < n; i++) fi >> a[i];
    return 0;
}

ucln(int x, int y)
{
    while (y > 0)
    {
        int r = x%y;
        x = y;
        y = r;
    }
    return x;
}

nt()
{
    doc();
    for (int i = 0; i < n-1; i++)
       for (int j = i+1; j < n; j++)
       {
           if (ucln(a[i],a[j]) == 1) fo << a[i] << " " << a[j] << endl;
       }
    return 0;
}

main ()
{
    nt();
	return 0;
}
