#include <fstream>
using namespace std;
ifstream fi("dayso.inp");
ofstream fo("ntcn.out");
long i;
long a[10000];
long k;
void ntcn(long a,long b)
{
    long x = a,y = b;
    while (x != y)
    {
        if (x > y) x = x - y;
        else y = y - x;
    }
    if (x == 1) k = 1;
}
int main()
{
    fi >> i;
    for (long j = 0; j < i; j++)fi >> a[j];
    for (long n = i-1; n >= 0; n--)
    {
        for (long m = 0; m < n; m++)
        {
            k = 0;
            if (n==m) continue;
            ntcn(a[n],a[m]);
            if (k == 1)
            {
                if (a[n] < a[m]) fo << a[n] << " " << a[m] << endl;
                else fo << a[m] << " " << a[n] << endl;
            }
        }
    }
    return 0;
}
