#include<bits/stdc++.h>
using namespace std;
ifstream fi("NTCN.inp");
ofstream fo("NTCN.out");
int gcd(int x, int y){
    int tg;
    while(x!=0 && y!=0 && x!=y){
        tg=x;
        x=y%x;
        y=tg;
    }
return y;
}
int main(){
 int n;
 fi>>n;
 vector<int>a(n);
 for(int i=0;i<n;++i)fi>>a[i];
 for(int i=0;i<n-1;++i)
     for(int j=i+1;j<n;++j)if(gcd(a[i],a[j])==1)fo<<a[i]<<' '<<a[j]<<endl;

}
