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

def solve():
    n=int(input())
    x=list(map(int,input().split()))
    list1=[]
    def ap1(num):
        list1.append(num)
    for i in range(n):
        ap1([x[i],i+1])
    str1= lambda val: val[0]
    list1.sort(key=str1)
    numa=[]
    numb=[]
    def apa(num):
        numa.append(num)
    def apb(num):
        numb.append(num)
    for i in range(n):
        num3=list1[i][1]
        for j in range(num3-1):
            apa(num3)
        for j in range(n-num3):
            apb(num3)
    count1=0
    count2=0
    count3=0
    ans=[]
    ansnum=0
    def apans(num):
        ans.append(num)
    for i in range(n*n):
        yn=0
        if count1!=n:
            if i==list1[count1][0]-1:
                apans(list1[count1][1])
                count1+=1
                yn=1
        if yn==0:
            if count2!=len(numa):
                apans(numa[count2])
                count2+=1
            elif count3!=len(numb):
                apans(numb[count3])
                count3+=1
            else:
                if i!=n*n-1:
                    ansnum=1
                    break
    list2=[]
    def countnum(num):
        return list2.count(num)
    for i in range(n):
        list2=ans[:list1[i][0]]
        if countnum(list1[i][1])!=list1[i][1]:
            ansnum=1
            break
    if ansnum==1:
        print("No")
    else:
        print("Yes")
        print(*ans)
solve()


### FIXED CODE ###

def solve():
    n=int(input())
    x=list(map(int,input().split()))
    list1=[]
    def ap1(num):
        list1.append(num)
    for i in range(n):
        ap1([x[i],i+1])
    str1= lambda val: val[0]
    list1.sort(key=str1)
    numa=[]
    numb=[]
    for i in range(n):
        num3=list1[i][1]
        numa+=[num3]*(num3-1)
        numb+=[num3]*(n-num3)
    count1=0
    count2=0
    count3=0
    ans=[]
    ansnum=0
    def countnum(num):
        return ans.count(num)
    def apans(num):
        ans.append(num)
    for i in range(n*n):
        yn=0
        if count1!=n:
            if i==list1[count1][0]-1:
                if countnum(list1[count1][1])!=list1[count1][1]-1:
                    ansnum=1
                    break
                apans(list1[count1][1])
                count1+=1
                yn=1
        if yn==0:
            if count2!=len(numa):
                apans(numa[count2])
                count2+=1
            elif count3!=len(numb):
                apans(numb[count3])
                count3+=1
            else:
                if i!=n*n-1:
                    ansnum=1
                    break
    if ansnum==1:
        print("No")
    else:
        print("Yes")
        print(*ans)
solve()
### BUGGY CODE ###

K,S = map(int, input().split())
count = 0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      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 0 <= S-i-j <= K:
        count += 1
print(count)
### BUGGY CODE ###


from heapq import *
from collections import defaultdict

def Dijkstra(s, V, E):
    # https://ja.wikipedia.org/wiki/%E3%83%80%E3%82%A4%E3%82%AF%E3%82%B9%E3%83%88%E3%83%A9%E6%B3%95
    d = defaultdict(lambda:10**20)
    d[s] = 0
    Q = []
    for v in V:
        heappush(Q, (d[v], v))
    while Q:
        x, u = heappop(Q)
        for v, y in E[u].items():
            alt = d[u] + y
            if d[v] > alt:
                d[v] = alt
                heappush(Q, (alt, v))
    return d

N, M, S, T = [int(_) for _ in input().split()]
UVAB = [[int(_) for _ in input().split()] for i in range(M)]

Ea = defaultdict(dict)
Eb = defaultdict(dict)

for u, v, a, b in UVAB:
    Ea[u][v] = a
    Ea[v][u] = a
    Eb[u][v] = b
    Eb[v][u] = b
    
V = list(range(1, N + 1))

Da = Dijkstra(S, V, Ea)
Db = Dijkstra(T, V, Eb)

T = [None] * (N + 1)
t = 10**30

for i in range(N, 0, -1):
    r = Da[i] + Db[i]
    t = min(t, r)
    T[i] = t

ST = 10**15

for i in range(1, N + 1):
    print(ST-T[i])


### FIXED CODE ###


from heapq import *
from collections import defaultdict

def Dijkstra(s, N, E):
    # https://ja.wikipedia.org/wiki/%E3%83%80%E3%82%A4%E3%82%AF%E3%82%B9%E3%83%88%E3%83%A9%E6%B3%95
    d = [10**30] * (N + 1)
    d[s] = 0
    Q = []
    for v in range(1, N + 1):
        heappush(Q, (d[v], v))
    while Q:
        x, u = heappop(Q)
        for v, y in E[u].items():
            alt = d[u] + y
            if d[v] > alt:
                d[v] = alt
                heappush(Q, (alt, v))
    return d

N, M, S, T = [int(_) for _ in input().split()]
UVAB = [[int(_) for _ in input().split()] for i in range(M)]

Ea = defaultdict(dict)
Eb = defaultdict(dict)

for u, v, a, b in UVAB:
    Ea[u][v] = a
    Ea[v][u] = a
    Eb[u][v] = b
    Eb[v][u] = b
    
Da = Dijkstra(S, N, Ea)
Db = Dijkstra(T, N, Eb)

T = [None] * (N + 1)
t = 10**30

for i in range(N, 0, -1):
    r = Da[i] + Db[i]
    t = min(t, r)
    T[i] = t

ST = 10**15

for i in range(1, N + 1):
    print(ST-T[i])
### BUGGY CODE ###

import math

N,K = map(int, input().split())
A = list(map(int, input().split()))
#epsilon = 10**(-9)
#A = [a-epsilon for a in A]

_min = 0
_max = max(A)

while int(_min)<int(_max):
  new = (_min+_max)/2
  if _min < int(new):
    new = int(new)
  times = sum([math.ceil(a/new)-1 for a in A])
  #print(_min, new, _max, times, [math.ceil(a/new)-1 for a in A])
  
  if times <= K:
    _max = new
  else:
    _min = new
  #print(_min, _max)

print(math.ceil(_max))

### FIXED CODE ###

import math

N,K = map(int, input().split())
A = list(map(int, input().split()))
epsilon = 10**(-5)
#A = [a-epsilon for a in A]

_min = 0
_max = max(A)

while _max - _min > epsilon:
  new = (_min+_max)/2
  if _min < int(new):
    new = int(new)
  times = sum([math.ceil(a/new)-1 for a in A])
  #print(_min, new, _max, times, [math.ceil(a/new)-1 for a in A])
  
  if times <= K:
    _max = new
  else:
    _min = new
  #print(_min, _max)

if  sum([math.ceil(a/_max)-1 for a in A]) <= K:
  print(math.ceil(_max))
else:
  print(math.ceil(_min))
### BUGGY CODE ###

def binary_search(list, item):
    low = 0
    lengyh = len(list)
    high = lengyh - 1

    while low <= high:
        mid = (low + high) // 2
        guess = list[mid]

        if guess == item - 1 or (mid < lengyh - 1 and (guess < item and list[mid + 1] > item)) or (mid == lengyh - 1 and guess < item):
            return mid
        if guess > item:
            high = mid - 1
        else:
            low = mid + 1

    return None


N = int(input())
str_l = input()
num = 0
L = []
for v in str_l.split(' '):
    L.append(int(v))

L.sort()
for i in range(N):
    a = L[i]
    for j in range(i, N - 1):
        b = L[j + 1]
        index = binary_search(L[j + 2:], a + b)
        if index is None:
            continue
        else:
            for k in range(0, index + 1):
                c = (L[j + 2:])[k]
                if b + c > a and a + c > b:
                    num += 1

print(num)


### FIXED CODE ###

import bisect


N = int(input())
str_l = input()
num = 0
L = []
for v in str_l.split(' '):
    L.append(int(v))

L.sort()
for i in range(N - 1):
    a = L[i]
    for j in range(i, N - 2):
        b = L[j + 1]
        index = bisect.bisect_left(L[j + 2:], a + b)
        num += index
        # for k in range(0, index):
        #     c = (L[j + 2:])[k]
        #     if b + c > a and a + c > b:
        #         num += 1

print(num)
### BUGGY CODE ###

import math
def bsearch_int(init_ng, init_ok, cond):
    ng = init_ng
    ok = init_ok
    while(abs(ok - ng) > 0):
        mid = math.floor(abs(ok + ng)/2)
        if cond(mid):
            ok = mid
        else:
            ng = mid
    return ok if ok != init_ok else -1

def condition(cnt, N, A, B, hs):
    basedmg = B*cnt
    diff = A - B
    diffcnt = 0
    for h in hs:
        if h < basedmg:
            break
        else:
            diffcnt += math.ceil((h-basedmg)/diff)
    if diffcnt > cnt:
        return False
    else:
        return True

import functools
def resolve():
    N, A, B = list(map(int, input().split(" ")))
    hs = [int(input()) for i in range(N)]
    hs.sort(reverse=True)
    print(bsearch_int(0, math.ceil(hs[0]/B), functools.partial(condition, N=N, A=A, B=B, hs=hs)))


if __name__ == '__main__':
    resolve()

### FIXED CODE ###

import math
def bsearch_int(init_ng, init_ok, cond):
    ng = init_ng
    ok = init_ok
    while(abs(ok - ng) > 1):
        mid = math.floor(abs(ok + ng)/2)
        if cond(mid):
            ok = mid
        else:
            ng = mid
    return ok

def condition(cnt, N, A, B, hs):
    basedmg = B*cnt
    diff = A - B
    diffcnt = 0
    for h in hs:
        if h < basedmg:
            break
        else:
            diffcnt += math.ceil((h-basedmg)/diff)
    if diffcnt > cnt:
        return False
    else:
        return True

import functools
def resolve():
    N, A, B = list(map(int, input().split(" ")))
    hs = [int(input()) for i in range(N)]
    hs.sort(reverse=True)
    print(bsearch_int(0, math.ceil(hs[0]/B), functools.partial(condition, N=N, A=A, B=B, hs=hs)))


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

n=int(input())
s=[]
for i in range(n):
    a=int(input())
    if a in s:
        for j in range(len(s)):
            if s[j]==a:
                s.pop(j)
                break
    else:
        s.append(a)
    #print(s)
print(len(s))

### FIXED CODE ###

from collections import Counter
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
index,cnt=zip(*Counter(a).most_common())
ans=0
for i in range(len(index)):
    if cnt[i]%2==1:
        ans+=1
print(ans)
#print(index,cnt)
### BUGGY CODE ###

# D - Various Sushi
import sys
from collections import defaultdict
import heapq

readline = sys.stdin.readline

dd = defaultdict(list)
N, K = map(int, readline().split())
for i in range(N):
    t, d = map(int, readline().split())
    heapq.heappush(dd[t], d*-1)

dd = list(dd.values())
dd.sort()

ans = 0
fix = 0
var = []
tmp_max = 0
for i in range(len(dd)):
    fix += heapq.heappop(dd[i]) * -1
    for _ in range(K-(i+1)):
        if len(dd[i]) == 0:
            break
        tmp = heapq.heappop(dd[i]) * -1
        heapq.heappush(var, tmp)
    while len(var) > K-(i+1) and len(var) > 0:
        heapq.heappop(var)
    if len(var) == K-(i+1):
        ans = max(ans , fix+sum(var) + (i+1)**2)


print(ans)

### FIXED CODE ###

# D - Various Sushi
import sys
from collections import defaultdict
import heapq

readline = sys.stdin.readline

dd = defaultdict(list)
N, K = map(int, readline().split())
for i in range(N):
    t, d = map(int, readline().split())
    heapq.heappush(dd[t], d*-1)

dd = list(dd.values())
dd.sort()

ans = 0
fix = 0
var = []
len_var = 0
sum_var = 0
tmp_max = 0

for i in range(min(K, len(dd))):
    fix += heapq.heappop(dd[i]) * -1
    for _ in range(len(dd[i])):
        tmp = heapq.heappop(dd[i]) * -1
        heapq.heappush(var, tmp)
        len_var += 1
        sum_var += tmp
    while len_var > K-(i+1) and len_var > 0:
        del_var = heapq.heappop(var)
        len_var -= 1
        sum_var -= del_var
    if len_var == K-(i+1):
        ans = max(ans , fix+sum_var + (i+1)**2)

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

n, q = map(int, input().split())
Tree = [[] for _ in range(n+1)]
Counter = [0 for _ in range(n+1)]
AB = (tuple(map(int, input().split())) for _ in range(n-1))
PX = (tuple(map(int, input().split())) for _ in range(q))

for a,b in AB:
  Tree[a].append(b)
  Tree[b].append(a)
  
for p,x in PX:
  Counter[p] += x

P = [-1]*(n+1)

nodes = [1]
while nodes:
  parent = nodes.pop(0)
  for node_i in Tree[parent]:
    if P[parent]==node_i:
      continue
    P[node_i] = parent
    nodes.append(node_i)
    Counter[node_i] += Counter[parent]

print(*Counter[1:])

### FIXED CODE ###

n, q = map(int, input().split())
Tree = [[] for _ in range(n+1)]
Counter = [0 for _ in range(n+1)]
AB = (tuple(map(int, input().split())) for _ in range(n-1))
PX = (tuple(map(int, input().split())) for _ in range(q))

for a,b in AB:
  Tree[a].append(b)
  Tree[b].append(a)
  
for p,x in PX:
  Counter[p] += x

P = [-1]*(n+1)

nodes = [1]
while nodes:
  parent = nodes.pop()
  for node_i in Tree[parent]:
    if P[parent]==node_i:
      continue
    P[node_i] = parent
    nodes.append(node_i)
    Counter[node_i] += Counter[parent]

print(*Counter[1:])
### BUGGY CODE ###

import numpy as np
from itertools import product
import sys
read = sys.stdin.buffer.read


C = np.array(read().split(), np.int32).reshape(3, 3)
i, j, k = np.max(C + 1, axis=1)
flag = 0
for i, j, k in product(range(i), range(j), range(k)):
    x = C[0, :] - i
    y = C[1, :] - j
    z = C[2, :] - k

    if np.all((x == y) & (y == z)):
        flag = 1
        break

print(['No', 'Yes'][flag])

### FIXED CODE ###

import numpy as np
from itertools import product
import sys
read = sys.stdin.buffer.read


C = np.array(read().split(), np.int32).reshape(3, 3)

a, b, c = np.max(C + 1, axis=1)
N = []
for i, j in product(range(a), range(b)):
    x = C[0, :] - i
    y = C[1, :] - j

    if np.all(x == y):
        N.append(x)

flag = 0
z = C[2, :]
for n in N:
    for k in range(c):
        if np.all(z - k == n):
            flag = 1
            break
    
    if flag:
        break

print(['No', 'Yes'][flag])
### BUGGY CODE ###

n=int(input())
a = list(input().split())
a = [int(i) for i in a]
l=[True]*n
sort = sorted(a)

for i in range(n):
  #print(sort[i], l)
  if l[i:] == [False]*len(sort[i:]):
    break
  if sort[i] == False:
    continue

  for ii in range (i+1,n):
    #print(sort[ii])
    if sort[ii] % sort[i] == 0:
      #print("割り切れる")
      l[ii] = False
    if sort[ii] == sort[i]:
      #print("重複")
      l[i] = False
      l[ii] = False

print(len([x for x in l if x]))
      


### FIXED CODE ###

from collections import Counter
max_=10**6+1
ans=0

n=int(input())
data=list(map(int,input().split()))

b=[True]*(max_+1)
data.sort()
c=Counter(data)
#print(c)

for d in data:
    if b[d]:
        for j in range(d,max_,d):
            b[j]=False
        if c[d]==1:#複数存在考慮
            ans+=1
print(ans)
### BUGGY CODE ###

a,b=map(int, input().split())

c=max(a,b)
flag=False
for i in range(c+1):
  if abs(a-i)==abs(b-i):
    print(i)
    flag=True
    break
if flag==False:
  print("IMPOSSIBLE")

### FIXED CODE ###

a,b=map(int, input().split())
if a<b:
  a,b=b,a
#a>b is assured.
k=(a+b)/2
if k%1==0 and b<k<a:
  print(int(k))
else:
  print("IMPOSSIBLE")
### BUGGY CODE ###

N = int(input())
l = []
for i in range(N):
    A = int(input())
    l.append(A)
ans = [0]*N
m = max(l)
for i in range(N):
    n = l[i]
    if  n == m:
        l[i] = 0
        ans[i] = max(l)
        ans = ans[:i+1]
        ans.extend([n]*(N-i-1))
        break
    ans[i] = max(l)
[print(i) for i in ans]


### FIXED CODE ###

n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
m = max(l)
ans = [m]*n
if len(set(l)) == 1 or l.count(m) > 1:
    for i in ans:
        print(i)
else:
    x = sorted(set(l))[-2]
    a = l.index(m)
    ans[a] = x
    for i in ans:
        print(i)
### BUGGY CODE ###

def lcp(S):
    N = len(S)
    prefix = [0] * N
    j = 0
    for i in range(1, N):
        if i + prefix[i - j] < j + prefix[j]:
            prefix[i] = prefix[i - j]
        else:
            k = max(0, j + prefix[j] - i)
            while i + k < N and S[k] == S[i + k]:
                k += 1
            prefix[i] = k
            j = i
    prefix[0] = N
    return prefix

N = int(input())
S = input()

ans = 0
for j in range(N):
    prefix = lcp(S[j:])
    for i, p in enumerate(prefix):
        if p <= i:
            ans = max(ans, p)
print(ans)



### FIXED CODE ###

def lcp(S):
    N = len(S)
    prefix = [0] * N
    j = 0
    for i in range(1, N):
        if i + prefix[i - j] < j + prefix[j]:
            prefix[i] = prefix[i - j]
        else:
            k = max(0, j + prefix[j] - i)
            while i + k < N and S[k] == S[i + k]:
                k += 1
            prefix[i] = k
            j = i
    prefix[0] = N
    return prefix

N = int(input())
S = input()

ans = 0
for j in range(N):
    prefix = lcp(S[j:])
    for i, p in enumerate(prefix):
        if p <= i:
            ans = max(ans, p)
print(ans)
### BUGGY CODE ###

H, W = map(int, input().split())
visited = [[True] * (W + 2)]
visited += [[True] + [x == '#' for x in list(input())] + [True] for _ in range(H)]
visited += [[True] * (W + 2)]
ans = -1
q = []
for i in range(1, H + 1):
    for j in range(1, W + 1):
        if visited[i][j]:
            q.append((i, j))

while q:
    tmp = []
    for h, w in q:
        if not visited[h - 1][w]:
            visited[h - 1][w] = True
            tmp.append((h - 1, w))
        if not visited[h + 1][w]:
            visited[h + 1][w] = True
            tmp.append((h + 1, w))
        if not visited[h][w - 1]:
            visited[h][w - 1] = True
            tmp.append((h, w - 1))
        if not visited[h][w + 1]:
            visited[h][w + 1] = True
            tmp.append((h, w + 1))
    q = tmp
    ans += 1
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

H,W = map(int,input().split())
INF = 10**18
q = []

visited = [[True]*(W+2)]
visited += [[True] + [x == '#' for x in input().rstrip()] + [True] for _ in range(H)]
visited.append([True]*(W+2))
for i in range(1,H+1):
  for j in range(1,W+1):
    if visited[i][j]:
      q.append((i,j))

moves = [(0,1),(0,-1),(1,0),(-1,0)] #全方向調べる

ans = -1
while q:
  qq = []
  ans += 1
  for x,y in q:
    if not visited[x-1][y]:
      visited[x-1][y] = True
      qq.append((x-1,y))
    if not visited[x+1][y]:
      visited[x+1][y] = True
      qq.append((x+1,y))
    if not visited[x][y-1]:
      visited[x][y-1] = True
      qq.append((x,y-1))
    if not visited[x][y+1]:
      visited[x][y+1] = True
      qq.append((x,y+1))
  q = qq
  
print(ans)
### BUGGY CODE ###

p = 50
while 1:
	n = input()
	if n == 0: break
	xy = sorted([map(int,raw_input().split()) for i in range(n)])
	x,y = xy[0]
	xy = sorted(xy, key = lambda XY:(XY[0]-x)**2 + (XY[1]-y)**2)
	ans = 0
	for i in range(n-4):
		x1,y1 = xy[i]
		for j in range(n-3,i,-1):
			x2,y2 = xy[j]
			dx,dy = x2-x1,y2-y1
			if [x1-dy,y1-dx] in xy[j+1:j+p] and [x2+dy,y2-dx] in xy[j+1:j+p]:
				ans = dx**2+dy**2
			if [x1-dy,y1+dx] in xy[j+1:j+p] and [x2-dy,y2+dx] in xy[j+1:j+p]:
				ans = dx**2+dy**2
			if ans: break
		if ans: break
	print ans

### FIXED CODE ###

while 1:
	n = input()
	if n == 0: break
	xy = [map(int,raw_input().split()) for i in range(n)]
	S = set(map(tuple,xy))
	ans = 0
	for i in range(n-1):
		x1,y1 = xy[i]
		for j in range(i+1,n):
			x2,y2 = xy[j]
			a = (x2-y2+y1,y2+x2-x1)
			b = (x1-y2+y1,y1+x2-x1)
			if a in S and b in S:
				ans = max(ans,(x1-x2)**2 + (y1-y2)**2)
	print ans
### BUGGY CODE ###

import sys
from bisect import bisect, bisect_left

class RMQ(): #range minimum query
    def __init__(self, N, V): #create segment tree with initial value V
        d, k = 1, 0
        while d < N:
            d <<= 1
            k += 1
        self.tree = [V] * (2 * d - 1)
        self.size = d
    
    def update(self, i, a): #update cell i by value a
        now = self.size - 1 + i 
        self.tree[now] = a
        while now > 0:
            now = (now - 1) // 2
            self.tree[now] = max(self.tree[2 * now + 1], self.tree[2 * now + 2])

    def search(self, lower, higher, lbound, hbound, pos): #search minimum value of [lower, higher) init: lbound = 0, hbound = self.size, pos = 0
        if higher <= lbound or hbound <= lower: return 0
        if lower <= lbound and hbound <= higher: return self.tree[pos]
        else:
            left = self.search(lower, higher, lbound, (lbound + hbound) // 2, 2 * pos + 1)
            right = self.search(lower, higher, (lbound + hbound) // 2, hbound, 2 * pos + 2)
            return max(left, right)

def solve():
    input = sys.stdin.readline
    N = int(input())
    R = [[int(i) for i in input().split()] for _ in range(N)]
    R.sort()
    mod = 998244353
    X = [R[i][0] for i in range(N)]
    D = [R[i][1] for i in range(N)]
    Connect = RMQ(N, 0)
    DP = [1] * (N + 1)
    for i in reversed(range(N)):
        right = max(i, Connect.search(i, bisect_left(X, X[i] + D[i]), 0, Connect.size, 0))
        Connect.update(i, right)
        DP[i] = (DP[right + 1] + DP[i + 1]) % mod
    print(DP[0])
    

    return 0

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys
from bisect import bisect, bisect_left

class SquareDiv(): #区間の最大値を求める
    def __init__(self, N, V):
        k = 1
        while k ** 2 < N: k += 1
        self.array = [V] * k
        self.size = k
        self.indivisual = [V] * N

    def update(self, i, v): #i番目をvに更新する
        self.indivisual[i] = v
        self.array[i // self.size] = max(self.array[i // self.size], v)

    def search(self, left, right): #[left, right]の最大値を求める
        lk, rk = left // self.size, right // self.size
        if lk == rk:
            maxN = 0
            for i in range(left, right + 1): maxN = max(maxN, self.indivisual[i])
            return maxN
        else:
            maxN = self.search(left, (lk + 1) * self.size - 1)
            for k in range(lk + 1, rk): maxN = max(maxN, self.array[k])
            maxN = max(maxN, self.search(rk * self.size, right))
            return maxN

def solve():
    input = sys.stdin.readline
    N = int(input())
    R = [[int(i) for i in input().split()] for _ in range(N)]
    R.sort()
    mod = 998244353
    X = [R[i][0] for i in range(N)]
    Connect = SquareDiv(N, 0)
    DP = dict()
    DP[N] = 1
    for i in reversed(range(N)):
        right = max(i, Connect.search(i, bisect_left(X, sum(R[i])) - 1))
        Connect.update(i, right)
        DP[i] = (DP[right + 1] + DP[i + 1]) % mod
    print(DP[0])
    

    return 0

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

import collections

N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
a = [kv for kv in c.items() if kv[1] == max(c.values())]
ans = sorted(a, key= lambda x:x[0])
for i in range(len(ans)):
  print(ans[i][0])

### FIXED CODE ###

N = int(input())
dic = {}

for i in range (N):
  s = input()
  if s in dic:
    dic[s] += 1
  else:
    dic[s] = 1

sai = max(dic.values())

for j in sorted(k for k in dic if dic[k] == sai):
  print(j)