#include <bits/stdc++.h>
using namespace std;
int n, a[100007];
int main() {
  int index = 0, maxprice = 0, second = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    if (a[i] > maxprice) {
      second = maxprice;
      index = i;
      maxprice = a[i];
    } else
      second = max(second, a[i]);
  }
  cout << index << " " << second;
}
