#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, mx = -1, x;
  cin >> n;
  int ar[n];
  for (i = 0; i < n; i++) {
    cin >> ar[i];
    if (ar[i] > mx) {
      mx = ar[i];
      x = i;
    }
  }
  mx = -1;
  ar[x] = -1;
  for (i = 0; i < n; i++) {
    if (ar[i] > mx) {
      mx = ar[i];
    }
  }
  cout << x + 1 << " " << mx;
}
