#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int b[n + 10], i;
    cin >> b[0];
    int max = b[0], idx = 0;
    for (i = 1; i < n; i++) {
      cin >> b[i];
      if (b[i] > max) {
        max = b[i];
        idx = i;
      }
    }
    b[idx] = -10;
    max = b[0];
    for (i = 1; i < n; i++) {
      if (b[i] > max) {
        max = b[i];
      }
    }
    cout << idx + 1 << ' ' << max << endl;
  }
  return 0;
}
