#include <bits/stdc++.h>
void swap(int* x, int* y) {
  int t = *x;
  *x = *y;
  *y = t;
}
int main() {
  int n;
  scanf("%d", &n);
  int a[n];
  int i = 0;
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  int index = 1;
  int max = a[0];
  for (i = 1; i < n; i++)
    if (a[i] > max) {
      max = a[i];
      index = i + 1;
    }
  for (i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i] > a[j]) swap(&a[i], &a[j]);
    }
  }
  printf("%d %d", index, a[1]);
  return 0;
}
