#include <bits/stdc++.h>
int main() {
  int n, mxpos = 0, mx = 0, temp, i;
  scanf("%d", &n);
  int p[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &p[i]);
    if (mx < p[i]) {
      mx = p[i];
      mxpos = i;
    }
  }
  int loopno = 0, j;
  int notsorted = 1;
  while (notsorted) {
    notsorted = 0;
    for (j = 0; j < n - loopno - 1; j++) {
      if (p[j] > p[j + 1]) {
        temp = p[j];
        p[j] = p[j + 1];
        p[j + 1] = temp;
        notsorted = 1;
      }
    }
    loopno++;
  }
  printf("%d %d", mxpos + 1, p[n - 2]);
  return 0;
}
