#include <bits/stdc++.h>
using namespace std;
const int maxN = 100 * 1000 + 321;
int a[maxN];
int main() {
  int n;
  cin >> n;
  int maxi = 0, index = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > maxi) {
      maxi = a[i];
      index = i;
    }
  }
  cout << index + 1 << ' ';
  sort(a, a + n);
  cout << a[n - 2] << endl;
  return 0;
}
