#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int bid[a];
  int pertama;
  for (int i = 0; i < a; i++) {
    cin >> bid[i];
  }
  int max1 = 0;
  int max2 = 0;
  int index;
  for (int i = 0; i < a; i++) {
    if (bid[i] > max1) {
      max2 = max1;
      max1 = bid[i];
      index = i + 1;
    } else if (bid[i] > max2) {
      max2 = bid[i];
    }
  }
  cout << index << " " << max2;
}
