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