public static void main(String[] args) throws IOException
    {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int[] array = new int[20];
        for (int i = 0; i < 20; i++)
        {
            array[i] = Integer.parseInt(reader.readLine());
        }

        int  maximum;
        int  minimum;

        //Напишите тут ваш код
        maximum = minimum = array[0];
        for (int i = 1; i < 20; i++)
        {
            if (maximum < array[i]) maximum = array[i];
            if (minimum > array[i]) minimum = array[i];
        }

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