import java.util.Scanner;
//C++写代码写习惯了,总是不给变量赋值就使用变量,本题若不给max,min赋值便会报错,故先把max和min的初始值声明,避免报错。
public class Main {
public static void main(String[] args) {
int[] ary = new int[6];
int max;
int min;
Scanner scanner = new Scanner(System.in);
for (int i = 0; i <ary.length ; i++) {
ary[i]=scanner.nextInt();
}
//write your code here......
max = ary[0];
min = ary[0];
for(int i = 0; i < ary.length; i++){
if(ary[i] > max) max = ary[i];
if(ary[i] < min) min = ary[i];
}
System.out.println(max+" "+min);
}
}