#include <bits/stdc++.h>
using namespace std;
int ucln(int a, int b)
{
    while (a!=b)
    {if (a>b)
        {
            a=a-b;
        }
        else b=b-a;
    }
    return a;
}

int main()
{
   ifstream fi("NTCN.inp");
   ofstream fo("NTCN.out");
   int n,i,j;
   fi>>n;
   int a[n+1];
for (i=1;i<=n;i++)
   {
       fi>>a[i];
   }
   for (i=1;i<n;i++)
    {for (j=i+1;j<=n;j++)
     if (ucln(a[i],a[j])==1)
   {
     fo<<a[i]<<" "<<a[j]<<endl;
   }}

   return 0;
}
