#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int val[n];
  int ind = 0;
  for (int i = 0; i < n; i++) {
    cin >> val[i];
    if (val[i] > val[ind]) {
      ind = i;
    }
  }
  sort(val, val + n);
  cout << ind + 1 << ' ' << val[n - 2];
}
