package com.javarush.task.task07.task0721;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/*
Минимаксы в массивах
*/

public class Solution {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int[] count1 = getInts(reader).clone();
        int maximum = count1[0];
        int minimum = count1[0];
        for (int i = 0; i < count1.length; i++) {;
           if(minimum > count1[i]) minimum = count1[i];
            if(maximum < count1[i]) maximum = count1[i];
        }


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

    public static int[] getInts(BufferedReader reader) throws IOException {
        int[] count = new int[20];
        for (int i = 0; i < count.length; i++) {
            count[i] = Integer.parseInt(reader.readLine());

        }

        return count;
    }

}