#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, w, x, y, z;
  int maxxx = 0;
  int index = 0;
  cin >> n;
  int arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] > maxxx) {
      maxxx = arr[i];
      index = i + 1;
    }
  }
  sort(arr, arr + n, greater<int>());
  cout << index << " " << arr[1];
  return 0;
}
