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