#include <bits/stdc++.h>
typedef struct bb {
  int price;
  int num;
} BB;
int compare(const void *data1, const void *data2) {
  BB *ptr1 = (BB *)data1;
  BB *ptr2 = (BB *)data2;
  if (ptr1->price > ptr2->price)
    return -1;
  else if (ptr1->price < ptr2->price)
    return 1;
  else
    return 0;
}
int main() {
  int n;
  BB bidder[1000];
  int i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &bidder[i].price);
    bidder[i].num = i + 1;
  }
  qsort(bidder, n, sizeof(BB), compare);
  printf("%d ", bidder[0].num);
  printf("%d", bidder[1].price);
  return 0;
}
