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

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

broken = []
for _ in range(M):
  broken.append(int(input()))

mod = 10 ** 9 + 7
f2, f1 = 0, 1
for i in range(1, N + 1):
  if i in broken:
    if i - 1 in broken:
      print(0)
      exit()
    f2 = f1
    f1 = 0
    continue
  f = (f2 + f1) % mod
  f2 = f1
  f1 = f
print(f)

### FIXED CODE ###

import sys
 
n, m = list(map(int, input().split()))
if m > 0:
    aaa = set(map(int, sys.stdin))
else:
    aaa = set()
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
MOD = 10 ** 9 + 7
 
for i in range(2, n + 1):
    if i in aaa:
        continue
    dp[i] = (dp[i - 2] + dp[i - 1]) % MOD
print(dp[n])
### BUGGY CODE ###

# input
N, K, Q = map(int, input().split())
points = [K] * N
for q in range(Q):
    A = int(input())

    # check
    points = list(map(lambda x: x - 1, points))
    points[A - 1] += 1

# output
for p in points:
    if p > 0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

# input
N, K, Q = map(int, input().split())
points = {}
for i in range(1, N + 1):
    points[i] = 0

for q in range(Q):
    A = int(input())

    # check
    points[A] += 1

# output
for k in points.keys():
    if K - Q + points[k] > 0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

S=input()
N=len(S)
A=[0]*(N+1)
Q=[0]*(N+1)
AB=[0]*(N+1)
AQandQB=[0]*(N+1)
QQ=[0]*(N+1)
ABC=[0]*(N+1)
for i in range(1,N+1):
  if S[i-1] is "A":
    A[i]=A[i-1]+1
    Q[i]=Q[i-1]
  elif S[i-1] is "?":
    A[i]=A[i-1]
    Q[i]=Q[i-1]+1
  else:
    A[i]=A[i-1]
    Q[i]=Q[i-1]
M=Q[N]
for i in range(1,N+1):
  AB[i]=AB[i-1]
  AQandQB[i]=AQandQB[i-1]
  QQ[i]=QQ[i-1]
  if S[i-1] is "B":
    AB[i]+=A[i-1]
    AQandQB[i]+=Q[i-1]
  elif S[i-1] is "?":
    AQandQB[i]+=A[i-1]
    QQ[i]+=Q[i-1]
for i in range(1,N+1):
  if S[i-1] is "C":
    ABC[i]=int((ABC[i-1]+AB[i-1]*(3**M)+(AQandQB[i-1])*(3**(M-1))+QQ[i-1]*(3**(M-2)))%(10**9+7))
  elif S[i-1] is "?":
    ABC[i]=int((ABC[i-1]+AB[i-1]*(3**(M-1))+(AQandQB[i-1])*(3**(M-2))+QQ[i-1]*(3**(M-3)))%(10**9+7))
  else:
    ABC[i]=ABC[i-1]
print(ABC[N]%(10**9+7))

### FIXED CODE ###

S=input()
N=len(S)
O=1
A=[0]*(N+1)
AB=[0]*(N+1)
ABC=[0]*(N+1)
for i in range(1,N+1):
  A[i]=A[i-1]
  AB[i]=AB[i-1]
  ABC[i]=ABC[i-1]
  if S[i-1] is "A":
    A[i]+=O
  elif S[i-1] is "B":
    AB[i]+=A[i-1]
  elif S[i-1] is "C":
    ABC[i]+=AB[i-1]
  elif S[i-1] is "?":
    A[i]*=3
    A[i]+=O
    AB[i]*=3
    AB[i]+=A[i-1]
    ABC[i]*=3
    ABC[i]+=AB[i-1]
    O*=3
  A[i]=A[i]%(10**9+7)
  AB[i]=AB[i]%(10**9+7)
  ABC[i]=ABC[i]%(10**9+7)
  O=O%(10**9+7)
print(int(ABC[N]%(10**9+7)))
### BUGGY CODE ###

import sys

h,w,m = map(int, sys.stdin.readline().split())
num_in_h = [0] * h
num_in_w = [0] * w
targets = []
for _ in range(m):
    t_h, t_w = map(lambda x: int(x)-1, sys.stdin.readline().split())
    num_in_h[t_h] += 1
    num_in_w[t_w] += 1
    targets.append((t_h, t_w))
targets = set(targets)

max_h_set = set([i for i, v in enumerate(num_in_h) if v == max(num_in_h)])
max_w_set = set([i for i, v in enumerate(num_in_w) if v == max(num_in_w)])
ans = max(num_in_h) + max(num_in_w) -1

flag = False
for i in max_h_set:
    for j in max_w_set:
        if (i, j) not in targets:
            flag = True
            break
    if flag: break

print(ans+1 if flag else ans)    


### FIXED CODE ###

import sys

h,w,m = map(int, sys.stdin.readline().split())
num_in_h = [0] * h
num_in_w = [0] * w
targets = set()
for _ in range(m):
    t_h, t_w = map(lambda x: int(x)-1, sys.stdin.readline().split())
    num_in_h[t_h] += 1
    num_in_w[t_w] += 1
    targets.add((t_h, t_w))

max_h = max(num_in_h)
max_w = max(num_in_w)
max_h_set = set([i for i, v in enumerate(num_in_h) if v == max_h])
max_w_set = set([i for i, v in enumerate(num_in_w) if v == max_w])
ans = max_h + max_w - 1

flag = False
for i in max_h_set:
    for j in max_w_set:
        if (i, j) not in targets:
            flag = True
            break
    if flag: break

print(ans+1 if flag else ans)
### BUGGY CODE ###

A , B = input().split(" ")
num1 = int(A)
num2 = int(B)
lcm = num1 if(num1 > num2) else num2
while(True):
    if((lcm % num1 == 0) and (lcm % num2 == 0)):
        print(lcm)
        break
    lcm += 1

### FIXED CODE ###

A , B = input().split(" ")
num1 = int(A)
num2 = int(B)
def gcd(num1,num2):
    if num1%num2 == 0:
        # Base case
        return num2
    else:
        # Iterative case
        return gcd(num2,num1%num2)
lcm = (num1*num2)//gcd(num1,num2)
print(lcm)
### BUGGY CODE ###

import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    k = ni()
    l = 2
    upper = 10 ** 16 + 1000
    lower = 0
    ans = [0 for _ in range(l)]
    ans[1] = (k % 2) ^ 1

    while True:
        middle = (upper + lower) // 2
        t_mid = middle
        t_ans = [0 for _ in range(l)]
        t_ans[0] = middle
        t_ans[1] = (k % 2) ^ 1

        cnt = 0
        while max(t_ans) >= l:
            for i in range(l):
                if t_ans[i] >= l:
                    div = t_ans[i] // l
                    cnt += div
                    t_ans[i] = t_ans[i] % l

                    for j in range(l):
                        if i != j:
                            t_ans[j] += div
        if cnt == k:
            ans[0] = middle
            break
        elif cnt < k:
            lower = middle
        elif cnt > k:
            upper = middle

    print(l)
    print(*ans, sep=" ")


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    k = ni()
    l = 50
    ans = [l - 1 for _ in range(l)]

    for i in range(l):
        ans[i] += k // l

    for i in range(l):
        tgt = k % l
        if i < tgt:
            ans[i] += l
            ans[i] -= tgt - 1
        else:
            ans[i] -= tgt

    print(l)
    print(*ans, sep=" ")


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

from scipy.sparse.csgraph import dijkstra
import sys 
input = sys.stdin.readline

def solve():
  n = int(input())
  d = [[float("inf")]*n for _ in range(n)]
  for i in range(n-1):
    a,b,c = (int(i) for i in input().split())
    d[a-1][b-1] = c

  q,k = (int(i) for i in input().split())
  
  d = dijkstra(d,directed=False,indices=k-1)

  for i in range(q):
    x,y = (int(i) for i in input().split())
    print(int(d[x-1] + d[y-1]))

solve()

### FIXED CODE ###


import sys 
input = sys.stdin.readline
from collections import deque
def solve():
  n = int(input())
  d = [[]*n for _ in range(n)]
  for i in range(n-1):
    a,b,c = (int(i) for i in input().split())
    d[a-1].append((b-1,c))
    d[b-1].append((a-1,c))
  q,k = (int(i) for i in input().split())
  #kからの距離を計算する
  d2 = [10**10]*n
  visit = [False]*n
  query = deque([(k-1,0)]) #始点、距離
  while query:
    place,dist = query.pop()
    if visit[place]:
      continue
    else:
      visit[place] = visit
      d2[place] = dist
      for i in range(len(d[place])):
        np,nc = d[place][i]
        if not visit[np]:
          query.append((np,nc+dist))
  for i in range(q):
    x,y = (int(i) for i in input().split())
    print(int(d2[x-1] + d2[y-1]))

solve()
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
q = int(input())

for i in range(q):
    ans = 0
    b, c = map(int, input().split())
    for j in range(n):
        A[j] = c if A[j] == b else A[j]
        ans += A[j]
    print(ans)


### FIXED CODE ###

from collections import Counter

n = int(input())
A = list(map(int, input().split()))
q = int(input())
cnt_A = dict(Counter(A))
ans = sum(A)
for i in range(q):
    b, c = map(int, input().split())
    if b in cnt_A and cnt_A[b] > 0:
        count = cnt_A[b]
        cnt_A[b] = 0
        if c not in cnt_A:
            cnt_A[c] = count
        else:
            cnt_A[c] += count
        ans += ((c - b) * count)
    print(ans)
### BUGGY CODE ###

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

def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]    
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=max(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k+1:
        k = (k-1)//2
        seg[k] = max(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = max(res,seg[p])
        if q&1 == 1:
            res = max(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = max(res,seg[p])
    else:
        res = max(max(res,seg[p]),seg[q])
    return res

#####単位元######
ide_ele = -1

#num:n以上の最小の2のべき乗
num =2**(n).bit_length()
seg=[ide_ele]*2*num

res = 0
s = [0]*(n+1)

update(p[0],0)
for i in range(1,n):
    k1 = query(p[i],n+1)
    if k1 != -1:
        update(p[k1],-1)
        k2 = query(p[i],n+1)
        s[i] = p[i]*(k1-k2) + s[k1]
        res += s[i]
        update(p[k1],k1)
    update(p[i],i)


ide_ele = -n
seg=[ide_ele]*2*num

s = [0]*(n+1)

update(p[-1],1-n)
for i in range(n-2,-1,-1):
    k1 = query(p[i],n+1)
    if k1 != -n:
        update(p[-k1],-n)
        k2 = query(p[i],n+1)
        s[i] = p[i]*(k1-k2)+s[-k1]
        res += s[i]
        update(p[-k1],k1)
    update(p[i],-i)

print(res)

### FIXED CODE ###

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

def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]    
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=max(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k+1:
        k = (k-1)//2
        seg[k] = max(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = max(res,seg[p])
        if q&1 == 1:
            res = max(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = max(res,seg[p])
    else:
        res = max(max(res,seg[p]),seg[q])
    return res

#####単位元######
ide_ele = -1

#num:n以上の最小の2のべき乗
num =2**(n).bit_length()
seg=[ide_ele]*2*num

res = 0
s = [0]*(n+1)

update(p[0],0)
for i in range(1,n):
    k1 = query(p[i],n+1)
    if k1 != -1:
        update(p[k1],-1)
        k2 = query(p[i],n+1)
        s[i] = p[i]*(k1-k2) + s[k1]
        res += s[i]
        update(p[k1],k1)
    update(p[i],i)


ide_ele = -n
seg=[ide_ele]*2*num

s = [0]*(n+1)

update(p[-1],1-n)
for i in range(n-2,-1,-1):
    k1 = query(p[i],n+1)
    if k1 != -n:
        update(p[-k1],-n)
        k2 = query(p[i],n+1)
        s[i] = p[i]*(k1-k2)+s[-k1]
        res += s[i]
        update(p[-k1],k1)
    update(p[i],-i)

print(res)
### BUGGY CODE ###

import itertools

n = input()
lengths = map(int, input().split())

len_combs = list(itertools.combinations(lengths, 3))
res = sum([a < b + c and b < c + a and c < a + b for a, b, c in len_combs])

print(res)


### FIXED CODE ###

from bisect import bisect_left

n = int(input())
lengths = sorted(map(int, input().split()))

res = 0
for i in range(n):
	l1 = lengths[i]
	for j in range(i + 1, n - 1):
		l2 = lengths[j]
		res += bisect_left(lengths, l1 + l2, j + 1) - j - 1

print(res)
### BUGGY CODE ###

def BC132_E():
    n, m = list(map(int, input().split(' ')))
    e = [[] for _ in range(n)]
    for _ in range(m):
        u, v = list(map(int, input().split(' ')))
        e[u - 1].append(v - 1)
    s, t = list(map(int, input().split(' ')))
    s, t = s - 1, t - 1
    stack, visited = [(s, 0)], set()
    while stack:
        i, d = stack.pop(0)
        if i in visited:
            continue
        visited.add(i)
        a = set()
        for j in e[i]:
            a.update(e[j])
        b = set()
        for j in list(a):
            b.update(e[j])
        b -= visited
        if t in b:
            return d + 1
        else:
            stack += [(x, d + 1) for x in list(b)]
    return -1


print(BC132_E())


### FIXED CODE ###

def BC132_E():
    n, m = list(map(int, input().split(' ')))
    e = [[] for _ in range(n)]
    for _ in range(m):
        u, v = list(map(int, input().split(' ')))
        e[u - 1].append(v - 1)
    s, t = list(map(int, input().split(' ')))
    s, t = s - 1, t - 1
    stack, visited = [(s, 0)], set()
    a, b = set(), set()
    while stack:
        i, d = stack.pop(0)
        if i == t: return d
        if i in visited:
            continue
        visited.add(i)
        v = set()
        for j in e[i]:
            if j in a: continue
            a.add(j)
            for k in e[j]:
                if k in b: continue
                b.add(k)
                v.update(e[k])
        if t in v:
            return d + 1
        else:
            stack += [(x, d + 1) for x in list(v)]
    return -1


print(BC132_E())
### BUGGY CODE ###

import math
import fractions
def isprime(number):
    for i in range(2, round(math.sqrt(number)) + 1):
        if number % i == 0:
            return False
    return True

A, B = map(int, input().split())
count = 1
N = fractions.gcd(A, B)

for i in range(2, N + 1):
    if N % i == 0:
        if isprime(i):
            count += 1

print(str(count))


### FIXED CODE ###

from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)
### BUGGY CODE ###

def main():
    N, W = map(int, input().split())
    wv = [list(map(int, input().split())) for _ in range(N)]

    DP = [[0 for _ in range(W*2)] for _ in range(N+1)]

    for i in range(N):
        for sum_w in range(W+1):

            if sum_w - wv[i][0] >= 0:
                DP[i+1][sum_w] = max(
                    DP[i][sum_w - wv[i][0]] + wv[i][1],
                    DP[i+1][sum_w])

            DP[i+1][sum_w] = max(DP[i][sum_w], DP[i+1][sum_w])

    print(DP[N][W])


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

def main():
    _input = sys.stdin.readline

    N, W = map(int, _input().split())
    wv = [list(map(int, _input().split())) for _ in range(N)]

    wv.sort()

    DP = [-1] * (W+1)
    DP[0] = 0

    sum_w = 0
    for w, v in wv:
        sum_w += w
        for j in range(min(W, sum_w), w-1, -1):
            if DP[j-w] == -1:
                continue
            if DP[j] < DP[j-w] + v:
                DP[j] = DP[j-w] + v
    print(max(DP))


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

N=int(input())
S=[input() for i in range(N)]

D={}
for i in range(N):
    if (S[i] in D.keys())==True:
        D[S[i]]+=1
    elif (S[i] in D.keys())==False:
        D[S[i]]=1

m=max(D.values())

M=[]
for i in D.keys():
    if D[i]==m:
        M.append(i)

M2=sorted(M)
for i in M2:
    print(i)

### FIXED CODE ###

N=int(input())
S=[input() for i in range(N)]

D={}
for i in range(N):
    try:
        if D[S[i]]>=1:
            D[S[i]]+=1
    except:
        D[S[i]]=1
E=sorted(D.items(),key=lambda x:x[1])
m=E[-1][1]
ans=[]
for i in E:
    if i[1]==m:
        ans.append(i[0])
for i in sorted(ans):
    print(i)
### BUGGY CODE ###

s = input()

ret = 0
while True :
    t = s.count('ABC')

    if t :
        ret += t
        s = s.replace('ABC', 'BCA')
    else :
        break

print(ret)

### FIXED CODE ###

s =  list(input())

ret = 0
i = 0
a = 0
bc = 0

while True :
    while i < len(s) and s[i] == 'A' :
        a += 1
        i += 1

    while i < len(s) - 1 and s[i:i+2] == ['B', 'C']  :
        bc += 1
        i += 2

    ret += a * bc

    bc = 0

    if i < len(s) and s[i] != 'A' :
        a = 0
        
    while i < len(s) and s[i] != 'A' :
        i += 1

    if i >= len(s) - 1 :
        break
    

print(ret)
### BUGGY CODE ###

mod = 998244353
N,K = map(int,input().split())
move = [list(map(int,input().split())) for _ in range(K)]

dp = [0]*(N+1)
dp_sum = [0]*(N+1)
dp[1] = dp_sum[1] = 1
for i in range(2,N+1):
    for l,r in move:
        if 0<i-l:
            dp[i] += dp_sum[i-l]
            if 0<i-r-1:
                dp[i] -= dp_sum[i-r-1]
    dp_sum[i] = dp_sum[i-1] + dp[i]
            
print(dp[-1]%mod)

### FIXED CODE ###

mod = 998244353
N,K = map(int,input().split())
move = [list(map(int,input().split())) for _ in range(K)]

dp = [0]*(N+1)
dp_sum = [0]*(N+1)
dp[1] = dp_sum[1] = 1
for i in range(2,N+1):
    for l,r in move:
        if 0<i-l:
            dp[i] += dp_sum[i-l]
            if 0<i-r-1:
                dp[i] -= dp_sum[i-r-1]
        dp[i] %= mod
    dp_sum[i] = dp_sum[i-1] + dp[i]
            
print(dp[-1]%mod)
### BUGGY CODE ###

n, m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
for k in range(m):
  s, t = map(int,input().split())
  if a[n-1] < t:
    for i in range(n):
      if a[n-i-1] >= t:
        a[n-i:n-i] = [t]*s
        break
      elif i + 1 == n:
        a[0:0] = [t]*s
ans = 0
for v in range(n):
  ans += a[v]
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
b = [list(map(int,input().split())) for p in [0]*m]
b.sort(key=lambda q: -q[1])
#print(a)
#print(b)

c = 0
for s in b:
	for t in [0]*s[0]:
		#print(s)
		if c + 1 > n:
			break
		if s[1] <= a[c]:
			break
		a[c] = s[1]
		c += 1
		#print(a)
	else:
		continue
	break
print(sum(a))
### BUGGY CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
import heapq
heapq.heapify(a)
BC=[list(map(int,input().split())) for _ in range(m)]
for i in range(m):
    while BC[i][0]>0:
        if BC[i][1] > a[0]:
            minA = heapq.heappop(a)
            heapq.heappush(a,BC[i][1])
            BC[i][0] -=1
        else:
            break
print(sum(a))

### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
import heapq
heapq.heapify(a)
BC=[list(map(int,input().split())) for _ in range(m)]
BC.sort(reverse=True,key=lambda x:x[1])
for i in range(m):
    while BC[i][0]>0:
        if BC[i][1] > a[0]:
            minA = heapq.heappop(a)
            heapq.heappush(a,BC[i][1])
            BC[i][0] -=1
        else:
            break
print(sum(a))
### BUGGY CODE ###

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

counter=0
while all(i%2==0 for i in n_length):
    n_list=[i/2 for i in n_length]
    counter=+1
print(counter)
    

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
cnt = 0

while True:
   if [i for i in a if i % 2 == 1]:
       break
   a = [i/2 for i in a]
   cnt += 1

print(cnt)
### BUGGY CODE ###

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


diff = 2020202020 * 200000 + 1
tot = sum(A)

for i in range(N):
    temp1 = A[:i+1]
    # temp2 = A[i+1:]
    temp3 = abs(tot - 2 * sum(temp1))
    if temp3 <= diff:
        # mid = i
        diff = temp3
    else:
        break

print(diff)


### FIXED CODE ###

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


diff = 2020202020 * 200000 + 1
tot = sum(A)

temp1 = 0

for i in range(N):
    temp1 += A[i]
    # temp2 = A[i+1:]
    temp3 = abs(tot - 2 * temp1)
    if temp3 <= diff:
        # mid = i
        diff = temp3
    else:
        break

print(diff)
### BUGGY CODE ###

from collections import defaultdict

N = int(input())
S = defaultdict(int)
for i in range(N):
    S[input()] += 1

for s in sorted(filter(lambda x: S[x] == max(S.values()), S), key=lambda x: x):
    print(s)

### FIXED CODE ###

from collections import defaultdict

N = int(input())
S = defaultdict(int)
for i in range(N):
    S[input()] += 1
m = max(S.values())
for s in sorted(filter(lambda x: S[x] == m, S)):
    print(s)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
def print_ans(N, Q, S, arr):
    """Test Case
    >>> print_ans(8, 3, "ACACTACG", [[3, 7], [2, 3], [1, 8]])
    2
    0
    3
    """
    for ar in arr:
        tmp_S = S[ar[0] - 1:ar[1]]
        print(tmp_S.count("AC"))

if __name__ == '__main__':
    N, Q = map(int, input().rstrip().split())
    S = input().rstrip()
    arr = [list(map(int, input().rstrip().split())) for _ in range(Q)]
    print_ans(N, Q, S, arr)


### FIXED CODE ###

import sys
input = sys.stdin.readline
def print_ans(N, Q, S, arr):
    """Test Case
    >>> print_ans(8, 3, "ACACTACG", [[3, 7], [2, 3], [1, 8]])
    2
    0
    3
    """
    t = [0] * (N+1)
    for i in range(N):
        t[i+1] = t[i] + (1 if S[i:i+2] == "AC" else 0)
    for ar in arr:
        print(t[ar[1] - 1] - t[ar[0] - 1] )

if __name__ == '__main__':
    N, Q = map(int, input().rstrip().split())
    S = input().rstrip()
    arr = [list(map(int, input().rstrip().split())) for _ in range(Q)]
    print_ans(N, Q, S, arr)
### BUGGY CODE ###

n = int(input())
s = []
for i in range(n):
  s_val = list(input())
  s_val.sort()
  s.append(s_val)
ans = 0
while s != []:
  for k in range(1,len(s)):
    if s[0] == s[k]:
      ans += 1
  s.remove(s[0])
print(ans)

### FIXED CODE ###

n = int(input())
dic = {}
ans = 0
for i in range(n):
  s = "".join(sorted(input()))
  a = dic.get(s)
  if a is None:
    dic[s] = 1
  else:
    ans += a
    dic[s] += 1
print(ans)
### BUGGY CODE ###

n = int(input())
temparr = input()
temparr = temparr.split()
arr = []
for i in temparr:
    arr.append(int(i))
    
ans = 0 
for i in range(n - 1):
    curnum = arr[i]
    for j in range(i + 1, n):
        ans += curnum * arr[j]
        if ans >= 1000000007:
            ans = ans % 1000000007

if ans >= 1000000007:
    print(ans % 1000000007)
else:
    print(ans)

### FIXED CODE ###

n = int(input())
temparr = input()
temparr = temparr.split()
arr = []
for i in temparr:
    arr.append(int(i)  % 1000000007)
    
ans = 0 
total = []
curtotal = sum(arr)
total.append(curtotal)
for i in range(n):
    curtotal -= arr[i]
    total.append(curtotal)
for i in range(n):
    total[i] = total[i] % 1000000007

for i in range(n - 1):
    curnum = arr[i]
    tempans = curnum * total[i + 1]
    if tempans >= 1000000007:
        tempans = tempans % 1000000007
    ans += tempans

if ans >= 1000000007:
    print(ans % 1000000007)
else:
    print(ans)
### BUGGY CODE ###

import numpy as np
N,M = map(int,input().split())
A = list(map(int,input().split()))

for i in range(M):
    ind = np.argmax(A)
    A[ind] = A[ind]//2

print(sum(A))

### FIXED CODE ###

import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N):
    A[i] = -A[i]
heapq.heapify(A)

for i in range(M):
    trgt = -heapq.heappop(A)//2
    heapq.heappush(A,-trgt)
print(-sum(A))
### BUGGY CODE ###

def factorize(n):
    p = n
    while True:
        if p % 2 == 0:
            p //= 2
            yield 2
        else:
            break

    r = 3
    while p != 1:
        if p % r == 0:
            p //= r
            yield r
        else:
            r += 2

n = int(input())
l = factorize(n)

print(str(n)+":",*list(l))

### FIXED CODE ###

import math

def factorize(p):
    l = []
    while p % 2 == 0:
        p //= 2
        l.append(2)

    r = 3
    while r < int(math.sqrt(p)+1):
        if p % r == 0:
            p //= r
            l.append(r)
        else:
            r += 2

    if p != 1:
        l.append(p)

    return l

n = int(input())
l = factorize(n)

print(str(n)+":",*l)