#include <bits/stdc++.h>
using namespace std;
int n, k, maxx, idx, max1, s;
int main(int argc, char *argv[]) {
  pair<int, int> a[10000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = 0;
  }
  maxx = 0;
  max1 = 0;
  for (int i = 0; i < n; i++) {
    if (a[i].first > maxx) {
      max1 = maxx;
      maxx = a[i].first;
      idx = i;
    } else if (max1 < a[i].first)
      max1 = a[i].first;
  }
  cout << idx + 1 << " " << max1 << endl;
  return EXIT_SUCCESS;
}
