#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> bil(n);
  vector<int> ans(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &bil[i]);
    ans[i] = bil[i];
  }
  sort(bil.rbegin(), bil.rend());
  int t = bil[0];
  int t1 = bil[1];
  for (int i = 0; i < ans.size(); ++i) {
    if (t == ans[i]) {
      printf("%d %d", i + 1, t1);
      break;
    }
  }
}
