#include <bits/stdc++.h>
const int MAX_N = 1e5 + 1;
const long long int MOD = 1e9 + 7;
const long long int INF = 1e9;
using namespace std;
void solve() {
  int n, max = 0, idx;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (v[i] > max) {
      max = v[i];
      idx = i + 1;
    }
  }
  sort(v.begin(), v.end());
  cout << idx << " " << v[v.size() - 2] << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
