BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int [] list = new int[20];

for (int i = 0; i < list.length; i++){
list[i] = Integer.parseInt(reader.readLine());}
int min = list[0];
int max = list[0];
for (int j = 0; j < list.length; j++)
{
    if (min < list[j]){min = list[j];}
    if (max > list[j]){max = list[j];}
}
System.out.print(max + " " + min);