#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[10005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + 1 + n);
  cout << a[n].second << " " << a[n - 1].first << endl;
}
