#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n;
struct node {
  int x, id;
} a[maxn];
bool cmp(node a, node b) { return a.x > b.x || (a.x == b.x && a.id < b.id); }
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].x;
    a[i].id = i;
  }
  sort(a + 1, a + 1 + n, cmp);
  cout << a[1].id << " " << a[2].x;
  return 0;
}
