#include <bits/stdc++.h>
using namespace std;
int a[1005];
int main() {
  int n, x = 0, p;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    x = max(x, a[i]);
    if (a[i] == x) {
      p = i;
    }
  }
  sort(a, a + n + 1);
  printf("%d %d", p, a[n - 1]);
  return 0;
}
