#include <bits/stdc++.h>
using namespace std;
stringstream ss;
long long mod = 1000000007LL;
pair<int, int> a[10010];
int main() {
  int n;
  cin >> n;
  for (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 << endl;
  return 0;
}
