package com.javarush.task.task07.task0712;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

/*
Самые-самые
*/

public class Solution {
    public static void main(String[] args) throws Exception {
        //напишите тут ваш код
        ArrayList<String> stringList = new ArrayList<>();
        int counter = 10;
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

//        counter of input strings
        while (counter > 0) {
            stringList.add(reader.readLine());
            counter--;
        }
//      sort first list by elements length
        ArrayList<String> sortedList = new ArrayList<>(stringList);
        Collections.sort(sortedList, new Comparator<String>() {

            @Override
            public int compare(String o1, String o2) {
                if (o1.length() > o2.length()) {
                    return 1;
                } else {
                    return o1.compareTo(o2);
                }
            }
        });

//        find min and max length
        int min = sortedList.get(0).length();
        int max = sortedList.get(stringList.size() - 1).length();

//        find which element is first
        for (int i = 0; i < stringList.size(); i++) {
            if (stringList.get(i).length() == min) {
                System.out.println(stringList.get(i));
                break;
            } else if (stringList.get(i).length() == max) {
                System.out.println(stringList.get(i));
                break;
            }
        }
    }
}