#include <bits/stdc++.h>
using namespace std;
const long long N = 10e9 + 5;
long long cnt, ans, sum, mx = -N, mn = N, mx1 = -N;
int main() {
  vector<long long> v;
  long long n, c;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> c;
    if (mx < c) {
      mx = c;
      ans = i + 1;
    }
    v.push_back(c);
  }
  for (long long i = 0; i < n; i++) {
    if (mx1 < v[i] && v[i] != mx) {
      mx1 = v[i];
    }
  }
  cout << ans << " " << mx1 << "\n";
}
