// Takmicenje.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool f(int a, int b) {

	return a <= b;

}
int main()
{
	int n;
	cin >> n;
	vector<int>knjige(n);
	vector<int>sorto(n);
	for (int i = 0; i < n; i++) {

		cin >> knjige[i];
	}
	sorto = knjige;
	int prom;
	prom = knjige[0];
	knjige[0] = knjige[1];
	knjige[1] = prom;
	
	cout << knjige[0] << " " << knjige[1];
	
	return 0;
}