1 import java.util.HashMap; 2 import java.util.Map; 3 import java.util.Scanner; 4 5 import javax.swing.text.html.HTMLDocument.Iterator; 6 7 public class Main{ 8 public static void main(String args[]) { 9 Scanner sc=new Scanner(System.in); 10 while(sc.hasNext()) { 11 int n=sc.nextInt(); 12 if(n==0) { 13 break; 14 } 15 Map<String,Integer> map=new HashMap<String,Integer>(); 16 for(int i=0;i<n;i++) { 17 String key=sc.next(); 18 if(!map.containsKey(key)) { 19 map.put(key, 1); 20 } 21 else { 22 int temp=map.get(key); 23 map.put(key, ++temp); 24 } 25 } 26 int max=Integer.MIN_VALUE; 27 String color=""; 28 java.util.Iterator<String> it=map.keySet().iterator(); 29 while(it.hasNext()) { 30 String theKey=it.next(); 31 int theValue=map.get(theKey); 32 if(max<theValue) { 33 color=theKey; 34 max=theValue; 35 } 36 } 37 System.out.println(color); 38 } 39 } 40 }