#include<iostream>
using namespace std;
int main()
{
int n;
int a, b, c, max, mid;
cin >> n;
cin >> a >> b >> c;
if(a>b)
{
if(b>c) max=a, mid=b;
else
{
if(a>c) max=a, mid=c;
else max=c, mid=a;
}
}
else
{
if(a>c) max=b, mid=a;
else
{
if(c>b) max=c, mid=b;
else max=b, mid=c;
}
}
cout << max <<" "<<mid<< endl;
return 0;
}
using namespace std;
int main()
{
int n;
int a, b, c, max, mid;
cin >> n;
cin >> a >> b >> c;
if(a>b)
{
if(b>c) max=a, mid=b;
else
{
if(a>c) max=a, mid=c;
else max=c, mid=a;
}
}
else
{
if(a>c) max=b, mid=a;
else
{
if(c>b) max=c, mid=b;
else max=b, mid=c;
}
}
cout << max <<" "<<mid<< endl;
return 0;
}