#include <bits/stdc++.h>
using namespace std;
int n, i, ans1, ans2, inbet, p[1000];
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> p[i];
    ans2 = max(ans2, p[i]);
    if (ans2 == p[i]) ans1 = i;
  }
  sort(p, p + n);
  cout << ans1 + 1 << " " << p[n - 2];
  return 0;
}
