#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  int max = 0;
  int ind = 0;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    if (temp > max) {
      max = temp;
      ind = i + 1;
    }
    v.push_back(temp);
  }
  int secmax = 0;
  sort(v.begin(), v.end());
  secmax = v[v.size() - 2];
  cout << ind << " " << secmax;
}
