#include <iostream>

using namespace std;

int main()
{
int N;
cin>>N;
int m1,m2;
int niz[N];
for (int i=1;i<N+1;i++)
{
    cin>>niz[i];
    m2=m1;
    m1=niz[i];
}
cout << m1 << " " << m2;
    return 0;
}