#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, mx = 0, flag;
  cin >> t;
  vector<int> v(t);
  for (int i = 0; i < t; i++) {
    cin >> v[i];
    if (v[i] > mx) {
      mx = v[i];
      flag = i + 1;
    }
  }
  sort(v.begin(), v.end());
  cout << flag << " " << v[v.size() - 2];
  return 0;
}
