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