#include <bits/stdc++.h>

using namespace std;

ifstream fi ("NTCN.INP");
ofstream fo ("NTCN.OUT");

bool ntcn(int a, int b){
   if (a==1&&b==1){return true;}
   else {while (a!=b){
    if (a>b) a = a - b;
    if (b>a) b = b - a;
    }
   if (a==1){return true;}
   else {return false;}
   }
}

int main(){
  int n;
  fi>>n;
  int a[n],i=0,k;
  for (i=0;i<n;i++){ fi >> a[i];}
  for (i=0;i<n;i++){
    for (k=i+1;k<n;k++){
        if (ntcn(a[i],a[k])==true){fo<<a[i]<<" "<<a[k]<<endl;}
    }
  }
}
