#include <bits/stdc++.h>
int main() {
  int n, i;
  int maximum, maxIndex, target;
  int A[1000];
  scanf("%d", &n);
  maximum = -1;
  for (i = 0; i < n; ++i) {
    scanf("%d", &A[i]);
    if (A[i] > maximum) {
      maximum = A[i];
      maxIndex = i;
    }
  }
  A[maxIndex] = -2;
  target = -1;
  for (i = 0; i < n; ++i) {
    if (A[i] > target) {
      target = A[i];
    }
  }
  printf("%d %d", maxIndex + 1, target);
  return 0;
}
