#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e3 + 10, N2 = 2e5, delta = 46639, mod = 1e9 + 7,
                    oo = 1e12, LOG = 20, SQ = 300;
const long double PI = 3.141592653589793;
pair<long long int, long long int> a[N];
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i + 1;
  }
  sort(a, a + n);
  cout << a[n - 1].second << ' ' << a[n - 2].first << '\n';
  return 0;
}
