#include <bits/stdc++.h>
using namespace std;
const int MAXn = 1000 + 13;
int main() {
  int n, ind, max1 = 0, max2 = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x > max1) {
      ind = i;
      max2 = max1;
      max1 = x;
    } else if (x > max2)
      max2 = x;
  }
  cout << ind + 1 << " " << max2 << endl;
  return 0;
}
