#include <bits/stdc++.h>
using namespace std;
int T;
int R, C;
int N, M;
string S;
int main() {
  int n, in;
  vector<pair<int, int> > v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> in;
    v.push_back({in, i});
  }
  sort(v.begin(), v.end());
  cout << v.back().second + 1 << " ";
  v.pop_back();
  cout << v.back().first << endl;
  return 0;
}
