#include <bits/stdc++.h>
int main() {
  int tab[2000], i, max = 0, posmax = 0, index = -1, n;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &tab[i]);
    if (tab[i] > max) {
      max = tab[i];
      posmax = i + 1;
    }
  }
  while (max-- && index == -1)
    for (i = 0; i < n; i++)
      if (tab[i] == max) {
        index = i;
        break;
      }
  printf("%d %d", posmax, tab[index]);
  return 0;
}
