#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  int imax = a[0], maxindex = 1;
  for (i = 1; i < n; i++) {
    if (imax < a[i]) {
      imax = a[i];
      maxindex = i + 1;
    }
  }
  cout << maxindex;
  int secondmax;
  if (a[0] < imax) {
    secondmax = a[0];
  } else {
    secondmax = a[1];
  }
  for (i = 0; i < n; i++) {
    if (a[i] > secondmax && a[i] < imax) {
      secondmax = a[i];
    }
  }
  cout << " " << secondmax;
  return 0;
}
