#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, max, k;
  cin >> n;
  int arr[n];
  priority_queue<int> save;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    save.push(arr[i]);
  }
  for (int i = 0; i < n; i++) {
    if (arr[i] == save.top()) {
      k = i + 1;
    }
  }
  save.pop();
  cout << k << " " << save.top();
}
