#include <bits/stdc++.h>
using namespace std;
int a[1005];
int main() {
  int n, i, t, b, c, max;
  while (~scanf("%d", &n)) {
    max = 0;
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    for (i = 0; i < n; i++) {
      if (a[i] > max) {
        max = a[i];
        t = i;
      }
    }
    sort(a, a + n);
    printf("%d %d\n", t + 1, a[i - 2]);
  }
  return 0;
}
