public class Solution {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int[] array = new int[20];

        int maximum = 0;
        int minimum = 500000000;

        for(int i=0;i<20;i++){
            array[i] = Integer.parseInt(reader.readLine());
        }
        for(int i=0;i<20;i++){
            if(maximum < array[i]) {
                maximum = array[i];
            }
            if(minimum > array[i]){
                minimum = array[i];

            }
        }
        System.out.print(maximum + " " + minimum);


    }
}