#include <bits/stdc++.h>
using namespace std;
int n, ind, p[1001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i];
  int ind = max_element(p, p + n) - p;
  cout << ind + 1 << " ";
  p[ind] = 0;
  ind = max_element(p, p + n) - p;
  cout << p[ind];
}
