#include <bits/stdc++.h>
using namespace std;
int a[10000];
int main() {
  int t;
  cin >> t;
  int m = -1, y = 0, o = 0, p = -1;
  for (int i = 0; i < t; i++) {
    cin >> a[i];
    if (a[i] > m) {
      m = a[i];
      o = i + 1;
    }
  }
  for (int i = 0; i < t; i++) {
    if (a[i] == m) {
      a[i] = 0;
    }
  }
  for (int i = 0; i < t; i++) {
    if (a[i] > p) {
      p = a[i];
    }
  }
  cout << o << " " << p << endl;
  return 0;
}
