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