#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int &i : v) {
    cin >> i;
  }
  int max_ele = INT_MIN;
  int _ele = INT_MIN;
  int index = 0;
  int prev = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] > max_ele) {
      prev = index;
      index = i;
      _ele = max_ele;
      max_ele = v[i];
    } else if (v[i] > _ele && v[i] != max_ele) {
      _ele = v[i];
    }
  }
  cout << index + 1 << " " << _ele << endl;
  return 0;
}
