#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 0, i, p;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    m = max(m, a[i]);
  }
  for (i = 0; i < n; i++)
    if (a[i] == m) p = i + 1;
  sort(a, a + n, greater<int>());
  for (i = 0; i < n; i++)
    if (a[i] != m) {
      cout << p << " " << a[i];
      return 0;
    }
}
