#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int x;
  cin >> x;
  int arr[1000];
  for (int i = 0; i < x; i++) {
    cin >> arr[i];
  }
  int max = arr[0];
  int pos = 0;
  for (int i = 0; i < x; i++) {
    if (arr[i] > max) {
      max = arr[i];
      pos = i;
    }
  }
  arr[pos] = 0;
  int prevMax = arr[0];
  for (int i = 0; i < x; i++) {
    if (arr[i] > prevMax) {
      prevMax = arr[i];
    }
  }
  cout << pos + 1 << " " << prevMax;
  return 0;
}
