N=int(input()) list1=[] for i in range(1001): list1.append([0,i]) #print(list1[1000]) for j in range(N): line=input() list1[line.count("^")][0]=list1[line.count("^")][0]+1 list1.sort(reverse=True) print(list1[0][1])