#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-12;
const double PI = acos(-1);
const long long INFF = (long long)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const int MAX = (int)1e3 + 7;
pair<int, int> st[MAX];
int main(void) {
  int n;
  scanf("%d", &n);
  ;
  for (int i = (1); i < (n + 1); ++i) {
    st[i].second = i;
    scanf("%d", &st[i].first);
  }
  sort(st + 1, st + n + 1);
  printf("%d %d\n", st[n].second, st[n - 1].first);
  return 0;
}
