#include <bits/stdc++.h>
void sort(int **arr, int n) {
  int min;
  for (int i = 0; i < n - 1; i++) {
    min = i;
    for (int j = i + 1; j < n; j++) {
      if (arr[j][1] < arr[min][1]) min = j;
    }
    int t0 = arr[i][0];
    int t1 = arr[i][1];
    arr[i][0] = arr[min][0];
    arr[i][1] = arr[min][1];
    arr[min][0] = t0;
    arr[min][1] = t1;
  }
}
int main() {
  int n, t;
  scanf("%d", &n);
  int **arr = (int **)malloc(n * sizeof(int *));
  for (int i = 0; i < n; i++) {
    arr[i] = (int *)malloc(2 * sizeof(int));
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    arr[i][0] = i + 1;
    arr[i][1] = t;
  }
  sort(arr, n);
  printf("%d %d\n", arr[n - 1][0], arr[n - 2][1]);
  return 0;
}
