#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[1000];
  int x, j = 1;
  cin >> x;
  for (int i = 0; i < x; i++) {
    cin >> a[i];
  }
  int max = a[0], max1 = 0;
  for (int i = 0; i < x; i++) {
    if (a[i] > max) {
      max1 = max;
      max = a[i];
      j = i + 1;
    }
    if (a[i] < max && a[i] > max1) {
      max1 = a[i];
    }
  }
  cout << j << " " << max1;
  return 0;
}
