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