#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
inline int poww(int a, int b) {
  int base = a, ans = 1;
  while (b) {
    if (b & 1) ans = (ans * base) % inf;
    base = (base * base) % inf;
    b >>= 1;
  }
  return ans;
}
inline int read() {
  int p = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    p = (p << 3) + (p << 1) + c - '0';
    c = getchar();
  }
  return f * p;
}
const int maxn = 1003;
struct item {
  int a, b;
} A[maxn];
int n;
bool cmp(item x, item y) { return x.a > y.a; }
int main() {
  n = read();
  for (int i = 1; i <= n; i++) A[i].a = read(), A[i].b = i;
  sort(A + 1, A + 1 + n, cmp);
  printf("%d %d\n", A[1].b, A[2].a);
  return 0;
}
