#include <bits/stdc++.h>
using namespace std;
int main() {
  typedef int* ints;
  int n, i, j, fk = 0, k, max, temp, fsk = 0;
  cin >> n;
  ints a = new int[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (j = 0; j < 2; j++) {
    max = a[j];
    for (k = j; k < n; k++) {
      if (a[k] > max) {
        max = a[k];
        fk = k;
        if (j == 0) fsk = k;
      }
    }
    temp = a[j];
    a[j] = a[fk];
    a[fk] = temp;
  }
  cout << fsk + 1 << " " << max << endl;
  return 0;
}
