/*#include <stdio.h>
int main()
{
int a,b,c,d,e;
scanf("%1d%1d%1d%1d%1d", &a, &b, &c, &d, &e);
printf("[%d]\n", a*10000);
printf("[%d]\n", b*1000);
printf("[%d]\n", c*100);
printf("[%d]\n", d*10);
printf("[%d]\n", e*1);
return 0;
}*/
#include <stdio.h>
int main()
{
int a,i,max=-1000000,min=1000000;
for(i=1;i<=5;i++)
{
scanf("%d", &a);
if(max<a)
{
max=a;
}
if(min>a)
{
min=a;
}
}
printf("%d\n%d", max, min);
return 0;
}