#include <bits/stdc++.h>
using namespace std;
int main() {
  priority_queue<pair<int, int> > PQ;
  int n, bid, pos, pay;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> bid;
    PQ.push(make_pair(bid, i));
  }
  pos = PQ.top().second;
  PQ.pop();
  pay = PQ.top().first;
  cout << pos << " " << pay;
  return 0;
}
