#include <bits/stdc++.h>
using namespace std;
int n, arr[1001];
int quickSelect(int k) {
  int from = 0, to = n - 1, r, w, mid, tmp;
  while (from < to) {
    r = from;
    w = to;
    mid = arr[(r + w) / 2];
    while (r < w) {
      if (arr[r] >= mid) {
        tmp = arr[w];
        arr[w] = arr[r];
        arr[r] = tmp;
        w--;
      } else
        r++;
    }
    if (arr[r] > mid) r--;
    if (k <= r) {
      to = r;
    } else {
      from = r + 1;
    }
  }
  return arr[k];
}
int main() {
  int maxprice = 0, index;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] > maxprice) index = i + 1, maxprice = arr[i];
  }
  cout << index << " " << quickSelect(n - 2);
  return 0;
}
