#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long i, indx, mx = 0;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    if (mx < a[i]) {
      mx = a[i];
      indx = i;
    }
  }
  sort(a.begin(), a.end());
  cout << indx + 1 << ' ' << a[n - 2] << endl;
  return 0;
}
