#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,e;
	cin>>a;
	cin>>b;
	cin>>c;
	cin>>d;
	cin>>e;
	if(a<b) swap(a,b);
	if(b<c) swap(b,c);
	if(c<d) swap(c,d);
	if(d<e) swap(d,e);
	if(a<e) swap(a,e);
	cout<<d<<" "<<e;
}

	


/**************************************************************
	Problem: 1639
	User: huangsiyuan
	Language: C++
	Result: Wrong Answer
****************************************************************/