#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a;
  cin >> a;
  int b[a];
  int i = 0;
  int temp, nomber;
  while (i < a) {
    cin >> b[i];
    i++;
  }
  temp = b[0];
  nomber = 0;
  i = 1;
  while (i < a) {
    if (b[i] > temp) {
      nomber = i;
      temp = b[i];
    }
    i++;
  }
  nomber++;
  sort(b, b + a);
  cout << nomber << ' ' << b[a - 2] << endl << endl;
}
