#include <bits/stdc++.h>
using namespace std;
int d[10000];
int main() {
  int a, b, g = 0, h, l = 0;
  cin >> a;
  for (int i = 1; i <= a; i++) cin >> d[i];
  for (int i = 1; i <= a; i++) {
    if (g <= d[i]) {
      g = d[i];
      l = i;
    }
  }
  d[l] = 0;
  g = 0;
  for (int i = 1; i <= a; i++) {
    if (d[i] > g) {
      g = d[i];
    }
  }
  cout << l << " " << g << endl;
  return 0;
}
