#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, maxn1, maxp1 = 1, maxn2 = 0;
  cin >> n >> maxn1;
  for (int i = 2; i <= n; i++) {
    cin >> x;
    if (x > maxn1) {
      maxn2 = maxn1;
      maxp1 = i;
      maxn1 = x;
    } else {
      maxn2 = max(maxn2, x);
    }
  }
  cout << maxp1 << ' ' << maxn2;
  return 0;
}
