#include <bits/stdc++.h>
int main() {
  int array[130], n, c, d, swap, flag = 0, count = 0, mount = 0;
  scanf("%d", &n);
  for (c = 0; c < n; c++) scanf("%d", &array[c]);
  for (c = 0; c < n - 1; c++) {
    for (d = 0; d < n - c - 1; d++) {
      if (array[d] > array[d + 1]) {
        swap = array[d];
        array[d] = array[d + 1];
        array[d + 1] = swap;
      }
    }
  }
  int value = array[n - 1];
  int value2 = array[n - 2];
  printf("%d ", array[n - 1]);
  for (c = n - 2; c > -1; c--) {
    if ((value % array[c]) != 0) {
      printf("%d", array[c]);
      flag = 1;
      break;
    } else if (array[c] == value) {
      printf("%d", array[c]);
      flag = 1;
      break;
    } else if ((array[c] != 1) && (array[c] == array[c - 1])) {
      printf("%d", array[c]);
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    printf("1");
  }
  return 0;
}
