#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int i, pok, a[10000], n, mn1, mn2;
int main() {
  i = 0;
  cin >> n;
  mn1 = 0;
  mn2 = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > mn2) {
      mn1 = mn2;
      mn2 = a[i];
      pok = i;
    } else if (a[i] > mn1)
      mn1 = a[i];
  }
  cout << pok + 1 << " " << mn1;
  return 0;
}
