#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int nz[n];
    for (int i = 1; i <= n; i++)cin>>nz[i];
    cout<<nz[n - 2]<<" "<<nz[n - 5];
    return 0;
}