#include <bits/stdc++.h>
using namespace std;
struct state {
  int row, col, val;
  state(int _r, int _c, int _v) : row(_r), col(_c), val(_v) {}
  bool operator<(const state &s) const { return val > s.val; }
};
pair<int, int> p[1005];
int main() {
  int n;
  scanf("%d", &n);
  int xx;
  for (int i = 0; i < n; i++) {
    scanf("%d", &xx);
    p[i] = make_pair(xx, i + 1);
  }
  sort(p, p + n);
  printf("%d %d\n", p[n - 1].second, p[n - 2].first);
  return 0;
}
