#include <bits/stdc++.h>
int price[1000];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int i;
    for (i = 0; i < n; i++) {
      scanf("%d", &price[i]);
      getchar();
    }
    int fir = 0, sec = 0;
    for (i = 1; i < n; i++) {
      if (price[i] > price[fir]) {
        fir = i;
      }
    }
    price[n] = price[fir];
    price[fir] = 0;
    for (i = 1; i < n; i++) {
      if (price[i] > price[sec]) {
        sec = i;
      }
    }
    printf("%d %d\n", fir + 1, price[sec]);
  }
  return 0;
}
