#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
int N, ans, P[100100], ord[100100];
int comp(int a, int b) { return P[a] > P[b]; }
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(15);
  cin >> N;
  for (int(i) = 1; (i) <= (N); (i)++) {
    cin >> P[i];
    ord[i] = i;
  }
  sort(ord + 1, ord + 1 + N, comp);
  cout << ord[1] << " " << P[ord[2]] << '\n';
}
