#include <bits/stdc++.h>
using namespace std;
struct node {
  int id, num;
} nod[11111];
bool cmp(node a, node b) { return a.num > b.num; }
int main() {
  int n, i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &nod[i].num), nod[i].id = i + 1;
  }
  sort(nod, nod + n, cmp);
  printf("%d %d", nod[0].id, nod[1].num);
  return 0;
}
