Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import numpy as np

n = int(input())
sl = list(input() for _ in range(n))
sl_set = list(set(sl))
sl_set.sort()

m = 0
l = []
for s in sl_set:
    a = sl.count(s)
    m = max(m, a)
    l.append(a)

m_idx = np.where(np.array(l) == m)
for i in m_idx[0]:
    print(sl_set[i])

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
from collections import Counter

n = int(input())
sl = list(input() for _ in range(n))
sl_dct = Counter(sl)
m = 0
for i in sl_dct.values():
    m = max(m,i)

sl_s =  list(set(sl))
sl_s.sort()
for i in sl_s:
    if sl_dct[i] == m:
        print(i)
### BUGGY CODE ###

k,s=map(int,input().split())

nums=[]

for i in  range(k+1):
    nums.append(i)

x=y=z=nums

count=0

for i in x:
    for j in y:
        for k in z:
            if i+j+k==s:
                count+=1
print(count)


### FIXED CODE ###

k,s=map(int,input().split())

count=0

for i in range(k+1):
    for j in range(k+1):
        if s-k<=i+j<=s:
            count+=1
print(count)
### BUGGY CODE ###

n,m=map(int,input().split())
day_pay=[]
for _ in range(n):
    a,b=map(int,input().split())
    day_pay.append((a, b))
day_pay.sort()

ans=0
for d in range(m-1, -1, -1):
    nokori=m-d
    best=0
    idx=n+2
    for i in range(len(day_pay)):
        day, pay=day_pay[i]
        if day>nokori:
            break
        else:
            if pay>=best:
                best=pay
                idx=i
            else:
                continue
    if idx<=len(day_pay):
        del day_pay[idx]
    ans+=best

print(ans)

### FIXED CODE ###

import heapq
N, M = map(int, input().split())

fee = [[] for _ in range(10**5+10)]  # i日後に収入がもらえるバイトの価値
for _ in range(N):
    a, b = map(int, input().split())
    fee[a].append(-b)

task = []
ans = 0

# 締め切り日からさかのぼっていって、できるバイトで最大の収入をもらえるやつを実行する感じ
for i in range(1, M + 1):
    for f in fee[i]:
        heapq.heappush(task, f)

    if task:
        ans -= heapq.heappop(task)

print(ans)
### BUGGY CODE ###

n,m = map(int,input().split())
if m == 1:
    print("IMPOSSIBLE")
    exit()
a = []
for i in range(m):
    arr = list(map(int,input().split()))
    a.append(arr)
l = [i[1] for i in a if i[0]==1]
for i in l:
    l_2 = [j[1] for j in a if j[0]==i]
    if n in l_2:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

### FIXED CODE ###

n,m = map(int,input().split())
if m == 1:
    print("IMPOSSIBLE")
    exit()
a = set()
b = set()
for i in range(m):
    arr = list(map(int,input().split()))
    if 1 in arr:a.add(arr[1])
    if n in arr:b.add(arr[0])
if len(a&b)==0:print("IMPOSSIBLE")
else:print("POSSIBLE")
### BUGGY CODE ###

# 15:20
n = int(input())
s = []
for i in range(n):
    s.append(input())
ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        if sorted(s[i]) == sorted(s[j]):
            ans += 1
print(ans)

### FIXED CODE ###

# 15:20 -16:08 giveup
# 21:45 -22:33 review
from collections import Counter

# 3
# acornistnt
# peanutbomb
# constraint
n = int(input())
s = [''.join(sorted(input())) for _ in range(n)]
# s is ['acinnorstt', 'abbemnoptu', 'acinnorstt']
counter = Counter(s)
# counter is Counter({'acinnorstt': 2, 'abbemnoptu': 1})
# counter.values() is dict_values([3, 2])
ans = sum(x*(x-1)//2 for x in counter.values())
print(ans)
### BUGGY CODE ###

import numpy as np

n = int(input())
a = np.array(list(map(int,input().split())))

[print(np.count_nonzero(a==i)) for i in range(1,n+1)]

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
al = [0 for i in range(n)]

for i in a:
    al[i-1] += 1
for i in range(n):
    print(al[i])
### BUGGY CODE ###

N=int(input())
A=[int(input()) for i in range(N)]
A.insert(0,0)
A.insert(N+1,0)
ans=max(A)
for i in range(1,N+1):
  if A[i]!=ans:
    print(ans)
  else:
    m1=max(A[:i])
    m2=max(A[i+1:])
    m=max(m1,m2)
    print(m)

### FIXED CODE ###

N=int(input())
A=[int(input()) for _ in range(N)]
B=sorted(A,reverse=True)

for i in range(N):
  if A[i]==B[0]:
    print(B[1])
  else:
    print(B[0])
### BUGGY CODE ###

N,M=map(int,input().split()) #N個の問題,M回の提出
A_list=[]#正解問題番号を入れる
W_list=[0]*N
WA=0
PS=[list(map(str,input().split())) for i in range(M) ]
ans=0
pena=0
for x in range(M):
    if PS[x][0] not in A_list:
        if PS[x][1]=='AC':
            A_list.append(PS[x][0])
            ans+=1
            WA+=W_list[int(PS[x][0])-1]
        else:
            pena+=1
            W_list[int(PS[x][0])-1]+=1

#print(ans,pena)
print(ans,WA)


### FIXED CODE ###

n, m = map(int, input().split())
AC = [0] * (n+1) #その問題で既に AC が出たか
b = [0] * (n+1) #その問題で WA が出た回数

WA = 0

for i in [0]*(m):

    s = input().split()

    if AC[int(s[0])] == 0:
        if s[1] == "AC":
            AC[int(s[0])] = 1
            WA += b[int(s[0])]
        else:
            b[int(s[0])] += 1

print(sum(AC), WA)
### BUGGY CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    s = input()
    q = I()
    K = LI()
    for k in K:
        ans = 0
        l = deque()
        sa = 0
        sb = 0
        ns = 0
        for i in range(n):
            if l:
                if i-l[0][0] >= k:
                    if l[0][1]:
                        sb -= 1
                    else:
                        ns -= sb
                        sa -= 1
                    l.popleft()
            if s[i] == "D":
                sa += 1
                l.append([i,0])
            elif s[i] == "M":
                sb += 1
                l.append([i,1])
                ns += sa
            elif s[i] == "C":
                ans += ns
        print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    s = input()
    q = I()
    K = LI()
    for k in K:
        d = 0
        m = 0
        dm = 0
        ans = 0
        for i in range(n):
            if i >= k:
                j = i-k
                if s[j] == "D":
                    d -= 1
                    dm -= m
                elif s[j] == "M":
                    m -= 1
            if s[i] == "D":
                d += 1
            elif s[i] == "M":
                m += 1
                dm += d
            elif s[i] == "C":
                ans += dm
        print(ans)
    return


#Solve
if __name__ == "__main__":
    solve()
### BUGGY CODE ###

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))

roads = []
for i in range(M):
    roads.append(list(map(int, input().split())))

goodcount = 0
for i in range(len(H)):
    isgood = True
    for r in roads:
        if r[0] == i+1 and H[i] <= H[r[1]-1]:
            isgood = False
        elif r[1] == i+1 and H[i] <= H[r[0]-1]:
            isgood = False
    if isgood:
        goodcount += 1

print(goodcount)

### FIXED CODE ###

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))

roads = []
for i in range(N):
    roads.append([])
    
for i in range(M):
    r = list(map(lambda x: int(x)-1, input().split()))
    roads[r[0]].append(r[1])
    roads[r[1]].append(r[0])

goodcount = 0
for i in range(len(H)):
    isgood = True
    for r in roads[i]:
        if H[i] <= H[r]:
            isgood = False
    if isgood:
        goodcount += 1

print(goodcount)
### BUGGY CODE ###

import sys

N = int(sys.stdin.readline().strip())
l_list = list(sorted(list(map(int, sys.stdin.readline().strip().split(" ")))))
count = 0

for i in reversed(range(2, N)):
    t_max = l_list[i]
    point = None
    for j in range(0, i-1):
        if l_list[j]+l_list[i-1] > t_max:
            point = j
            break
    if point is None:
        continue
    count += (i-1-point)

    for j in reversed(range(point, i-1)):
        point_sec = None
        t_sec = l_list[j]
        for k in range(point, j):
            if l_list[k]+l_list[j] > t_max:
                point_sec = k
                break
        if point_sec is None:
            continue
        count += (j-point_sec)

print(count)


### FIXED CODE ###

import sys

def bi_search(array, target):
    l, r = -1, len(array)-1
    while r-l > 1:
        mid = int((r+l)/2)
        if array[mid] > target:
            r = mid
        else:
            l = mid
    return r

N = int(sys.stdin.readline().strip())
l_list = list(sorted(list(map(int, sys.stdin.readline().strip().split(" ")))))
count = 0
#print(l_list)

for i in reversed(range(N)):
    a = l_list[i]
    for j in reversed(range(i)):
        b = l_list[j]
        index = bi_search(l_list[:j], a-b)
        """
        print("====")
        print(b-a)
        print(i, j, index)
        """
        if index > -1 and index < j and l_list[index] + b > a:
            count += (j-index)

print(count)
### BUGGY CODE ###

from collections import Counter
import sys

H,W,M,*hw = map(int,open(0).read().split())

h = hw[::2]
w = hw[1::2]

hw_set = set((hi,wi) for hi,wi in zip(h,w))


raw_count = Counter(h)
col_count = Counter(w)

raw_max = raw_count.most_common()[0][1]
col_max = col_count.most_common()[0][1]

ans = 0
for hi, rcount in raw_count.most_common():
    if rcount<raw_max:break
    for wi, ccount in col_count.most_common():
        if ccount<col_max: break
        
        if (hi,wi) in hw_set:
            ans = raw_max + col_max - 1
        else:
            print(raw_max + col_max)
            sys.exit()

print(ans)


### FIXED CODE ###

from collections import Counter
import sys

H,W,M,*hw = map(int,open(0).read().split())

h = hw[::2]
w = hw[1::2]

hw_set = set((hi,wi) for hi,wi in zip(h,w))


raw_count = Counter(h).most_common()
col_count = Counter(w).most_common()


raw_max = raw_count[0][1]
col_max = col_count[0][1]

ans = 0
for hi, rcount in raw_count:
    if rcount<raw_max:break
    for wi, ccount in col_count:
        if ccount<col_max: break
        
        if (hi,wi) in hw_set:
            ans = raw_max + col_max - 1
        else:
            print(raw_max + col_max)
            sys.exit()

print(ans)
### BUGGY CODE ###

from collections import deque

H,W=map(int,input().split())
if H==1 and W==1:
    print(0)
    exit()

A=[]
B=deque([])
C=[[-1]*W for i in range(H)]
cnt=0
for h in range(H):
    temp=list(input())
    A.append(temp)
    for w in range(W):
        if A[h][w]=="#":
            B.append([h,w,0])
            C[h][w]=0
            cnt+=1


step=[[1,0],[-1,0],[0,1],[0,-1]]
ans=[]
while B:
    P=B.popleft()
    for x,y in step:
        if 0<=P[0]+y<=H-1 and 0<=P[1]+x<=W-1:
            if C[P[0]+y][P[1]+x]==-1:
                B.append([P[0]+y,P[1]+x,P[2]+1])
                C[P[0]+y][P[1]+x]=1
                ans.append(P[2]+1)
                cnt+=1
                if cnt==H*W:break

print(max(ans))




### FIXED CODE ###

from collections import deque

H,W=map(int,input().split())
if H==1 and W==1:
    print(0)
    exit()

A=[]
B=deque([])
C=[[-1]*W for i in range(H)]
ans=[]
for h in range(H):
    temp=list(input())
    A.append(temp)
    for w in range(W):
        if A[h][w]=="#":
            B.append([h,w,0])
            C[h][w]=0
            ans.append(0)



step=[[1,0],[-1,0],[0,1],[0,-1]]

while B:
    P=B.popleft()
    for x,y in step:
        if 0<=P[0]+y<=H-1 and 0<=P[1]+x<=W-1:
            if C[P[0]+y][P[1]+x]==-1:
                B.append([P[0]+y,P[1]+x,P[2]+1])
                C[P[0]+y][P[1]+x]=1
                ans.append(P[2]+1)


print(max(ans))
### BUGGY CODE ###

from collections import Counter
n = int(input())
arr = list(map(int, input().split()))
c = Counter(arr)
nums = set(arr)
check = dict(zip(arr, [1 for _ in range(n)]))
highest = max(arr)
for num in arr:
    i = 2
    if c[num] > 1:
        check[num] = 0
    while num * i <= max(arr):
        v = num*i
        if v in nums:
            check[v] = 0
        i += 1
count = 0
for val in check.values():
    if val == 1:
        count += 1
print(count)

### FIXED CODE ###

from collections import defaultdict
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
ap = defaultdict(int)
for i in range(1, n):
    if arr[i] == arr[i-1]:
        ap[arr[i]] = 1
        
for i in range(n):
    if not ap[arr[i]]:
        count += 1
    if i == 0 or arr[i] != arr[i-1]:
        for j in range(arr[i], 1000001, arr[i]):
            ap[j] = 1
print(count)
### BUGGY CODE ###

from collections import deque
import heapq
import sys
input = sys.stdin.readline

f=lambda:map(int,input().split())
V,E,L=f()
G=[[] for _ in [0]*(V+1)]
# G=[]

for _ in range(E):
    s,t,d=f()
    if d<=L:
        G[s].append((t,(0,d)))
        G[t].append((s,(0,d)))
    
INF=10**15

def dijk(s):
    # q[i]:点i+1の現状のコスト
    q=[((0,0),s)]
    heapq.heapify(q)

    res=[(INF,INF)]*(V+1)
    while q:
        C,p=heapq.heappop(q)
        if C<res[p]:
            res[p]=C
        else:
            continue
        for np,D in G[p]:
            d=D[1]+C[1]
            if d>L:
                costB=(1+C[0]+D[0],D[1])
            else:
                costB=(C[0]+D[0],d)
            heapq.heappush(q,(min(res[np],costB),np))
    return res

res=[0]+[dijk(i+1) for i in range(V)]

Q=int(input())
for _ in [0]*Q:
    s,t=f()
    r=res[s][t][0]
    print(r if r<INF else -1)

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

f=lambda:map(int,input().split())
N,M,L=f()
G=[[0]*N for _ in [0]*N]
for _ in [0]*M:
    a,b,c=f()
    G[a-1][b-1]=c
    G[b-1][a-1]=c
    
csr=csr_matrix(G)

D=floyd_warshall(csr)
INF=float('inf')
G=[[INF]*N for _ in [0]*N]
for i in range(N):
    for j in range(N):
        if i!=j and D[i][j]<=L:
            G[i][j]=1
            G[j][i]=1
csr=csr_matrix(G)
res=floyd_warshall(csr)
Q=int(input())
for _ in [0]*Q:
    s,t=f()
    r=res[s-1][t-1]
    print(int(r-1) if r<INF else -1)
### BUGGY CODE ###

length = int(input())
data = [int(i) for i in input().split()]

for i in range(1, length+1):
  print(data.count(i))

### FIXED CODE ###

from collections import Counter

length = int(input())
data = [int(i) for i in input().split()]

c = Counter(data)

for i in range(1, length+1):
  print(c[i])
### BUGGY CODE ###

N=int(input())
listA=list(map(int,input().split()))
ans=0
L=[]
R=[]
for i in range(N):
  L+=[i+listA[i]]
  R+=[i-listA[i]]
setL=set(L)  
setR=set(R)
for i in R:
  if i in setL:
    ans+=L.count(i)
print(ans) 

### FIXED CODE ###

N=int(input())
listA=list(map(int,input().split()))
ans=0
L=[]
R=[]
L1=[0]*N
R1=[0]*N
for i in range(N):
  L+=[i+listA[i]]
  R+=[i-listA[i]]
  try:
    L1[i+1+listA[i]]+=1
  except:
    pass
  try:
    if i-listA[i]>0:
      R1[i+1-listA[i]]+=1
  except:
    pass
for i in range(N):
  ans+=L1[i]*R1[i]
print(ans)
### BUGGY CODE ###

from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = d[0]
MOD = 1000000007
ans = 0
for i in range(1, num):
    k = lcm(k, d[i])
for i in range(num):
    ans += k // d[i] % MOD
print(ans % MOD)

### FIXED CODE ###

from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = 1
MOD = 1000000007
ans = 0
for a in d:
    k = lcm(k, a)
for a in d:
    ans += k // a
print(ans % MOD)
### BUGGY CODE ###

import sys

A, B, Q = map(int, input().split())
S = [int(sys.stdin.readline()) for _ in range(A)]
T = [int(sys.stdin.readline()) for _ in range(B)]
X = [int(sys.stdin.readline()) for _ in range(Q)]
INF = 10**12

def binary_search(query, arr):
    arr = [-INF] + arr + [INF]
    low = 0
    high = len(arr)
    t = (low+high)//2
    for _ in range(100):
        if query>arr[t]:
            low = t
        else:
            high = t
        t = (low+high)//2
        if low>=high-1:
            break
    return arr[low], arr[high]

def find(query):
    s1, s2 = binary_search(query, S)
    t1, t2 = binary_search(query, T)
    return s1, s2, t1, t2

def main():
    for x in X:
        s1, s2, t1, t2 = find(x)
        cands = [
            abs(t1-x) + abs(s2-t1),
            abs(s1-x) + abs(t2-s1),
            abs(s2-x) + abs(t1-s2),
            abs(t2-x) + abs(s1-t2),
            abs(t1-x) + abs(s1-t1),
            abs(s1-x) + abs(t1-s1),
            abs(s2-x) + abs(t2-s2),
            abs(t2-x) + abs(s2-t2)
        ]
        print(min(cands))
    return

main()

### FIXED CODE ###

A, B, Q = map(int, input().split())
INF = 10**12
S = [-INF] + [int(input()) for _ in range(A)] + [INF]
T = [-INF] + [int(input()) for _ in range(B)] + [INF]
X = [int(input()) for _ in range(Q)]


def binary_search(query, arr):
    low = 0
    high = len(arr)
    while high-low>1:
        mid = (low+high)//2
        if query>arr[mid]:
            low = mid
        else:
            high = mid
    return arr[low], arr[high]

def main():
    for x in X:
        s1, s2 = binary_search(x, S)
        t1, t2 = binary_search(x, T)
        ans = [ abs(t-s)+min(abs(t-x), abs(s-x)) \
            for t in [t1, t2] for s in [s1, s2] ]
        print(min(ans))
    return

main()
### BUGGY CODE ###

A, B, N = map(int, input().split())


def calc(x):
    return (A*x)//B - A*(x//B)

index = 1
prev = -1
max_num = 0
flag = True
if B == 1:
    flag = False
    max_num = 0

if A >= B:
    flag = True
    max_num = calc(N)

while flag and index <= N:
    tmp = calc(index)
    if tmp < prev:
        flag = False
    else:
        prev = tmp
    if max_num < tmp:
        max_num = tmp
    index += 1

print(max_num)


### FIXED CODE ###

A, B, N = map(int, input().split())


def calc(x):
    return (A*x)//B - A*(x//B)

print(calc(min(B-1, N)))
### BUGGY CODE ###

from itertools import count, takewhile

def dfs(n):
  if n < 6:
    return n
  max9 = max(takewhile(lambda x: x<=n, (9**i for i in count())))
  max6 = max(takewhile(lambda x: x<=n, (6**i for i in count())))
  return min(dfs(n-max9), dfs(n-max6))+1

print(dfs(int(input())))

### FIXED CODE ###

from itertools import takewhile, chain, count
 
n = int(input())
 
def powers(a, n):
   return takewhile(lambda x: x<=n, (a**i for i in count(1)))
 
draws = sorted(set(chain([1], powers(6, n), powers(9, n))))
d = {}
for draw, last_draw in zip(draws[1:], draws):
  d[draw, 0] = 0
  for i in range(1, n+1):
    d[draw, i] = min(d.get((draw, i-draw), n)+1, d.get((last_draw, i), i))
 
print(d.get((max(draws), n), n))
### BUGGY CODE ###

k = int(input())
seven = 7
count = 0

for _ in range(1000000):
    if k % 2 == 0:
        count = -1
        break

    elif seven % k == 0:
        count += 1
        break
    else:
        count += 1
        seven = seven * 10 + 7

print(count)

### FIXED CODE ###

def main():
    k = int(input())
    num = 1
    n = 7

    if (k % 2 == 0):
        print(-1)
        return
    
    for i in range(1000000):
        if (n % k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7) %k
            num += 1
    print(-1)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

n=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(n):
    c=A.index(min(A))
    B.append(c+1)
    A[c]=n+1
print(*B)

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
B=[0]*n
for i in range(n):
    B[A[i]-1]=i+1
print(*B)
### BUGGY CODE ###

n = input()
s = list(input())

count = 0
for i in range(1000):
    a = str(i)
    a = list(a.zfill(3))
    sw = 0
    for j in range(len(s)):
        if sw == 0:
            if a[0] == s[j]:
                sw = 1
        elif sw == 1:
            if a[1] == s[j]:
                sw = 2
        elif sw == 2:
            if a[2] == s[j]:
                count += 1
                break
print(count)

### FIXED CODE ###

n = input()
s = list(input())

count = 0
for i in range(1000):
    a = str(i)
    a = list(a.zfill(3))
    sw = 0
    for j in range(len(s)):
        if sw == 0:
            if a[0] == s[j]:
                sw = 1
        elif sw == 1:
            if a[1] == s[j]:
                sw = 2
        elif sw == 2:
            if a[2] == s[j]:
                count += 1
                break
print(count)
### BUGGY CODE ###

N = int(input())

L = []
LL = []
S = set()
for i in range(N):
  s = input()
  L.append(s)
  if s not in S:
    S.add(s)
    LL.append(s)

L.sort()
LL.sort()

M = 0
for i in LL:
  M = max(M, L.count(i))
for i in LL:
  if L.count(i) == M:
    print(i)


### FIXED CODE ###

N = int(input())

dict = {}
L = []

for i in range(N):
  s = input()
  if s in dict:
    dict[s] = dict[s] + 1
  else:
    dict[s]=1
    L.append(s)

L.sort()

M = 0
for i in dict:
  M = max(M, dict[i])

for i in L:
  if dict[i] == M:
    print(i)
### BUGGY CODE ###

# from math import gcd
from fractions import gcd
from functools import reduce
 
n = int(input())
a = [int(x) for x in input().split()]
 
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
lcm = lcm_list(a)
ans = 0
for i in range(len(a)):
    ans += lcm // a[i] % 1000000007
print(ans % 1000000007)

### FIXED CODE ###

# from math import gcd
from fractions import gcd
from functools import reduce

def lcm_list(numbers):
    return reduce(lambda x, y: (x * y) // gcd(x, y), numbers, 1)

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    lcm = lcm_list(a)
    aa = []
    for i in range(len(a)):
        aa.append(lcm // a[i])
    ans = sum(aa) % 1000000007
    print(ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

N, K = map(int, input().split())
H_list = list(map(int, input().split()))
INF = 1 << 100
dp = [INF] * N
dp[0] = 0
for i in range(1, N):
    for j in range(1, K + 1):
        if i - j < 0: break
        #print(dp,i,j)
        #print(abs(H_list[i] - H_list[i - j]))
        dp[i] = min(dp[i - j] + abs(H_list[i] - H_list[i - j]), dp[i])
print(dp[N-1])

### FIXED CODE ###

N, K = map(int, input().split())
H_list = list(map(int, input().split()))
INF = 1 << 100
dp = [INF] * N
dp[0] = 0
for i in range(1, N):
    for j in range(1, K + 1):
        if i - j < 0: break
        #print(dp,i,j)
        #print(abs(H_list[i] - H_list[i - j]))
        dp[i] = min(dp[i - j] + abs(H_list[i] - H_list[i - j]), dp[i])
print(dp[N-1])
### BUGGY CODE ###

from collections import defaultdict
a = int(input())
idxs = defaultdict(int)
idxs[a] = 1
i = 1
ans = None
while True:
  i += 1
  if a % 2 == 0:
    a //= 2
  else:
    a = 3 * a + 1
    
  if not idxs[a]:
    idxs[a] = i
  else:
    ans = i

print(ans)
    
    



### FIXED CODE ###

from collections import defaultdict
a = int(input())
idxs = defaultdict(int)
idxs[a] = 1
i = 1
ans = None
while True:
  i += 1
  if a % 2 == 0:
    a //= 2
  else:
    a = 3 * a + 1
    
  if not idxs[a]:
    idxs[a] = i
  else:
    ans = i
    break

print(ans)