#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, pmax, pmaxsc = 0, p, kmax = 1;
  cin >> n;
  cin >> pmax;
  for (int i = 1; i < n; i++) {
    cin >> p;
    if (p > pmax) {
      pmaxsc = pmax;
      pmax = p;
      kmax = i + 1;
    } else if (p > pmaxsc)
      pmaxsc = p;
  }
  cout << kmax << " " << pmaxsc;
  return 0;
}
