public class Solution {
    public static void main(String[] args) throws Exception {
        //在此编写你的代码
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(reader.readLine());
        }

        int min = list.get(0).length();
        int max = list.get(0).length();
        for (int i = 1; i < list.size(); i++) {
            if (min > list.get(i).length())
                min = list.get(i).length();
            if (max < list.get(i).length())
                max = list.get(i).length();
        }

        shortestFound:
        longestFound:
        for (int i = 0; i < list.size(); i++) {
            //look for longest string
            if (list.get(i).length() == max){
                for (int j = 0; j < list.size(); j++) {
                    //look for shortest string
                    if (list.get(j).length() == min)
                        //If the longest string appears before the shortest string,
                        //display the longest string.
                        if (j == i+1){
                            System.out.println(list.get(i));
                            //if longest Found,Interrupt all loops
                            break longestFound;
                        }
                }
            }
            //if didn't find the longest, keep going to look for shortest string
            if (list.get(i).length() == min){
                for (int j = 0; j < list.size(); j++) {
                    //look for longest string
                    if (list.get(j).length() == max)
                        // If the shortest string appears before the longest string,
                        //display the longest string.
                        if (j == i+1){
                            System.out.println(list.get(i));
                            //if shortest Found ,Interrupt all loops
                            break shortestFound;
                        }
                }
            }

        }
    }
}