#include <bits/stdc++.h>
using namespace std;
int main() {
  int a_size;
  cin >> a_size;
  int p[a_size + 1];
  p[0] = 0;
  for (int i = 1; i <= a_size; i++) {
    cin >> p[i];
  }
  int max = 0, max_ind = 0;
  for (int i = 1; i <= a_size; i++) {
    if (p[i] > max) {
      max_ind = i;
      max = p[i];
    }
  }
  max = 0;
  for (int i = 1; i <= a_size; i++) {
    if (i == max_ind) continue;
    if (p[i] > max) {
      max = p[i];
    }
  }
  cout << max_ind << " " << max << endl;
  return 0;
}
