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