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