#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, max = 0, max2 = 0, indexm, indexm2;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    if (temp >= max) {
      max2 = max;
      indexm2 = indexm;
      max = temp;
      indexm = i + 1;
    } else if (temp > max2) {
      max2 = temp;
      indexm2 = i + 1;
    }
  }
  cout << indexm << " " << max2 << endl;
  return 0;
}
