#include <bits/stdc++.h>
int main() {
  int n, num, largest = 0, second = 0, index = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &num);
    if (num > largest) {
      second = largest;
      largest = num;
      index = i;
    } else if (num > second) {
      second = num;
    }
  }
  printf("%d %d", index, second);
  return 0;
}
