#include <bits/stdc++.h>
using namespace std;
typedef struct name {
  int sum;
  int id;
} N;
bool cmp(N a, N b) { return a.sum > b.sum; }
int main(int argc, char** argv) {
  int n;
  cin >> n;
  N a[1000];
  for (int i = 1; i <= n; i++) {
    cin >> a[i].sum;
    a[i].id = i;
  }
  sort(a + 1, a + 1 + n, cmp);
  cout << a[1].id << " " << a[2].sum << endl;
  return 0;
}
