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

#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    result_list = []
    for i in range(1, N + 1):
        result_list.append(str(A.index(i) + 1))
    print(" ".join(result_list))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    l = [None] * N
    for i in range(0, N):
        l[A[i] - 1] = str(i + 1)
    print(" ".join(l))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


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

S = input()
texts = ["dream", "dreamer", "erase", "eraser"]
T = [""]
max_count = len(S) // 5 + 1

match = False
count = 0
while count < max_count:
    if S in T:
        match = True
        break
    for i in range(len(T)):
        for j in texts:
            T.append(T[i]+j)
    count += 1

if match:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

S = input()
S_rvs = S[::-1]
texts = ["maerd", "remaerd", "esare", "resare"]

match = True
while len(S_rvs) > 0:
    if (S_rvs[0:5] == "maerd") or (S_rvs[0:5] == "esare"):
        S_rvs = S_rvs[5:]
    elif S_rvs[0:6] == "resare":
        S_rvs = S_rvs[6:]
    elif S_rvs[0:7] == "remaerd":
        S_rvs = S_rvs[7:]
    else:
        match = False
        break

if match:
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

a, b, x = map(int, raw_input().split())

i = a
count = 0
while i < b + 1:
    if i%x == 0:
        count = count + 1
    i = i + 1

print count


### FIXED CODE ###

a, b, x = map(int, raw_input().split())

i = a
count = 0
count_b = 0
count_a = 0

count_b = b/x
count_a = (a-1)/x


print count_b - count_a
### BUGGY CODE ###

N=int(input())
a=input().split()
A=[int(b) for b in a]
whole=sum(A)
answers=[]
for n in range(1,N):
    first=sum(A[:n])
    last=whole-first
    answers.append(abs(first-last))
print(min(answers))


### FIXED CODE ###

N=int(input())
a=input().split()
a=[int(b) for b in a]
numbers=[]
number=0
for a_ in a:
    number+=a_
    numbers.append(number)
del numbers[-1]
if N==2:
    print(abs(a[0]-a[1]))
else:
    whole=sum(a)
    answers=[]
    for number in numbers:
        answer=abs(number*2-whole)
        answers.append(answer)
    print(min(answers))
### BUGGY CODE ###

N = int(input())

dic = []
cnt = [0 for _ in range(N)]

for i in range(N):
    s = input()
    test = {}
    for ss in s:
        if not ss in test:
            test[ss] = 1
        else:
            test[ss] += 1
    for j, prev in enumerate(dic):
        if prev == test:
            cnt[j] += 1
            break
    dic.append(test)

ans = 0
for i in cnt:
    for j in range(1, i+1):
        ans += j
print(ans)

### FIXED CODE ###

N = int(input())
s = [input() for _ in range(N)]

dic = {}
ans = 0

for ss in s:
    temp = [ch for ch in ss]
    temp.sort()
    sss = "".join(temp)
    
    if sss in dic:
        ans += dic[sss]
        dic[sss] += 1
    else:
        dic[sss] = 1

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

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))
MAX = max(A)
def primes(n):#nまでの素数を列挙0は入れちゃダメ
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return is_prime
prime = primes(MAX)
pri = [i for i in range(2,MAX+1) if prime[i]]
def factorization(n): #2以上の整数n => [[素因数, 指数], ...]の2次元リストを返す
    arr = defaultdict(int)
    temp = n
    for i in range(2,int(n**0.5)+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr[i] += cnt
    if temp!=1:
        arr[temp] = 1
    if len(arr) == 0:
        arr[n] = 1
    return arr
c = factorization(A[0])
for i in range(1,N):
    nex = factorization(A[i])
    for j in pri:
        aa = max(c[j],nex[j])
        c[j] = aa
ans = 0
for i in range(N):
    a = A[i]
    p = factorization(a)
    plus = 1
    for j in pri:
        plus *= pow(j,c[j]-p[j],MOD)
    ans += plus
    ans %= MOD
print(ans)




    


### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))
L = A[0]
for i in range(1,N):
    g = math.gcd(L,A[i])
    L = L*A[i]//g
ans = 0
L %= MOD
for i in range(N):
    ans += (L*pow(A[i],MOD-2,MOD))
    ans %= MOD
print(ans)
### BUGGY CODE ###

N = int(input())
INF = float("inf")
es = [[INF for _ in range(N)] for _ in range(N)]
for i in range(N-1):
    a,b,c = map(int, input().split())
    a,b = a-1, b-1
    es[a][b] = c
    es[b][a] = c

Q, K = map(int, input().split())
xy = []
for i in range(Q):
    x,y = map(int, input().split())
    xy.append([x-1, y-1])

checked = [False] * N

d = [INF] * N
d[K-1] = 0
def dijkstra(s):
    while True:
        v = -1
        for i in range(N):
            if checked[i] == False and v == -1:
                v = i
            elif checked[i] == False and d[i] < d[v]:
                v = i
        if v == -1:
            break
        
        checked[v] = True
        for i in range(N):
            d[i] = min(d[i], d[v] + es[v][i])
    return

dijkstra(K-1)

for x,y in xy:
    print(d[x] + d[y])


### FIXED CODE ###

import sys
sys.setrecursionlimit 
N = int(input())
# 再帰の深さを増やしておく
sys.setrecursionlimit(10**9+1)

nodes = [[] for _ in range(N+1)]
for i in range(N-1):
      a,b,c, = map(int, input().split())
      # a->bとb->aの両方について保存
      nodes[a].append((b,c))
      nodes[b].append((a,c))

memo = [0] * (N+1)

# searchedというdistを持たせて調べた場所を管理するのも可能か
def dfs(cur, prev, dist):
      # ある地点（K）から現在地点までのコストを記入しておくことで、最終的にKから他のノードまでの距離が記入される
      memo[cur] = dist
      # nodes[a]から移動できる先と距離を取り出す
      for next, cost in nodes[cur]:
            # 移動前に戻ると無限ループするので飛ばす。searchedなりを持たせてもいい
            if next == prev:
                  continue
            # 移動先について探索を行う
            dfs(next, cur, dist+cost)

Q,K = map(int, input().split())
dfs(K, 0, 0)
for _ in range(Q):
      x,y = map(int, input().split())
      print(memo[x]+memo[y])
### BUGGY CODE ###

N, M = map(int, input().split())
flag = True
for i in range(N, M//2 + 1):
    if M%i == 0:
        print(M//i)
        flag = False
        break
if flag:
    print(1)

### FIXED CODE ###

N, M = map(int, input().split())
# また答えが見つかってなければTrue
flag = True
for i in range(N, M//10 + 1):
    if M%i == 0:
        print(M//i)
        flag = False
        break
for i in range(9):
    if flag and M%(10 - i) == 0 and M//(10 - i) >= N:
        print(10 - i)
        flag = False
if flag:
    print(1)
### BUGGY CODE ###

from collections import deque

N, M, L = map(int, input().split())
routes = [[] for i in range(N+1)]

for i in range(M):
    a, b, c = map(int, input().split())
    routes[a].append([b, c])
    routes[b].append([a, c])


def bfs(start, goal, full_energy):
    todo = deque([])
    for to, cost in routes[start]:
        if full_energy - cost >= 0:
            todo.append([to, full_energy-cost, 0])

    while todo:
        now, power, charge = todo.popleft()
        if now == goal:
            return charge

        for nex, cost in routes[now]:
            if power - cost >= 0:
                todo.appendleft([nex, power-cost, charge])
            todo.append([nex, full_energy-cost, charge+1])
    return -1


memo = [[-2]*(N+1) for i in range(N+1)]
Q = int(input())
for i in range(Q):
    s, t = map(int, input().split())
    if memo[s][t] == -2:
        count = bfs(s, t, L)
        memo[s][t], memo[t][s] = count, count
    print(memo[s][t])



### FIXED CODE ###

from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import floyd_warshall

n, m, energy = map(int, input().split())
edges = [[float('INF')]*n for _ in range(n)]

for i in range(m):
    a, b, c = map(int, input().split())
    edges[a-1][b-1] = c
    edges[b-1][a-1] = c

G = csgraph_from_dense(edges, null_value=float('INF'))
dist = floyd_warshall(G)

L_edges = [[float('INF')]*n for _ in range(n)]
for i in range(n-1):
    for j in range(i, n):
        if dist[i][j] <= energy:
            L_edges[i][j] = 1
            L_edges[j][i] = 1

G = csgraph_from_dense(L_edges, null_value=float('INF'))
answers = floyd_warshall(G)

Q = int(input())
for i in range(Q):
    s, t = map(int, input().split())
    ans = answers[s-1][t-1] - 1
    if ans == float('INF'):
        ans = -1
    print(int(ans))
### BUGGY CODE ###

import heapq

X, Y, A, B, C= list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort(reverse=True)
P = P[:X]
Q = list(map(int, input().split()))
Q.sort(reverse=True)
Q = Q[:Y]
R = list(map(int, input().split()))
R.sort(reverse=True)
colored = []
for r in R:
    p_min = P[-1]
    q_min = Q[-1]
    if p_min <= q_min and p_min < r:
        P.pop()
        P.insert(0, r)
    elif q_min <= p_min and q_min < r:
        Q.pop()
        Q.insert(0, r)
    else:
        break
print(sum(P) + sum(Q))

### FIXED CODE ###

import heapq

X, Y, A, B, C= list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort(reverse=True)
P = P[:X]
heapq.heapify(P)
Q = list(map(int, input().split()))
Q.sort(reverse=True)
Q = Q[:Y]
heapq.heapify(Q)
R = list(map(int, input().split()))
R.sort(reverse=True)
for r in R:
    p_min = P[0]
    q_min = Q[0]
    if p_min <= q_min and p_min < r:
        heapq.heapreplace(P, r)
    elif q_min <= p_min and q_min < r:
        heapq.heapreplace(Q, r)
    else:
        break
print(sum(P) + sum(Q))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

#input
N, M = map(int, input().split())
s = [0] * M
t = [0] * M
for i in range(M):
    s[i], t[i] = map(int, input().split())

#output
#（便宜的に地点から-1としておく）
u = [[]] * (N-1)
for v in s:
    u[v-1] = [t-1 for i, t in enumerate(t) if s[i] == v]

#地点vにたどり着く確率をp[v]とする。
p = [0] * N
p[0] = 1
for x, y in enumerate(u):
    for z in y:
        p[z] += p[x]/len(y)

#期待値をゴールから逆順に求めていく。点vからゴールまでの移動距離の期待値をq[v]とする。
q = [0] * N
q[N-1] = 0
for x, y in list(enumerate(u))[::-1]:
    q[x] = sum(q[z] for z in y)/len(y) + 1

v = [0] * N
for i in range(N-1):
    a = len(u[i])
    if a > 1:
        b = max(q[c] for c in u[i])
        v[i] = p[i]*(q[i] - (1+b))/(a-1)

print(q[0]+min(v))

### FIXED CODE ###

import sys
input = sys.stdin.readline

#input
N, M = map(int, input().split())
u = [[] for i in range(N-1)]
#（便宜的に地点から-1としておく）
for i in range(M):
    s, t = map(int, input().split())
    u[s-1].append(t-1)

#output
#地点vにたどり着く確率をp[v]とする。
p = [0] * N
p[0] = 1
for x, y in enumerate(u):
    for z in y:
        p[z] += p[x]/len(y)

#期待値をゴールから逆順に求めていく。点vからゴールまでの移動距離の期待値をq[v]とする。
q = [0] * N
q[N-1] = 0
for x, y in list(enumerate(u))[::-1]:
    q[x] = sum(q[z] for z in y)/len(y) + 1

v = [0] * N
for i in range(N-1):
    a = len(u[i])
    if a > 1:
        b = max(q[c] for c in u[i])
        v[i] = p[i]*(q[i] - (1+b))/(a-1)

print(q[0]+min(v))
### BUGGY CODE ###

def popcount(n):
    return bin(n).count('1')

def main():
    N = int(input())
    X = input()

    X_int = int(X, 2)

    pcount_X = popcount(X_int)

    for i,bit in enumerate(X):
        bit = int(bit)
        pcount_Xi = pcount_X + (-1)**bit

        if pcount_Xi == 0:
            print(0)
            continue

        if bit == 0:
            n = ((X_int % pcount_Xi) + pow(2, N-i-1, pcount_Xi)) % pcount_Xi
        else:
            n = ((X_int % pcount_Xi) - pow(2, N-i-1, pcount_Xi)) % pcount_Xi

        ans = 1
        while n > 0:
            ans += 1
            n %= popcount(n)
        print(ans)
        
main()

### FIXED CODE ###

def popcount(n):
    return bin(n).count('1')


def main():
    N = int(input())
    X = input()

    X_int = int(X, 2)

    pcount_X = popcount(X_int)

    pcount_X_pls1 = pcount_X + 1
    pcount_X_mns1 = pcount_X - 1
    
    X_mod_pcount_X_pls1 = X_int % pcount_X_pls1
    if pcount_X_mns1 != 0:
        X_mod_pcount_X_mns1 = X_int % pcount_X_mns1

    for i,bit in enumerate(X):
        bit = int(bit)
        if bit == 0:
            n = (X_mod_pcount_X_pls1 + pow(2, N-i-1, pcount_X_pls1)) % pcount_X_pls1
        else:
            if pcount_X_mns1 == 0:
                print(0)
                continue
            n = (X_mod_pcount_X_mns1 - pow(2, N-i-1, pcount_X_mns1)) % pcount_X_mns1

        ans = 1
        while n > 0:
            ans += 1
            n %= popcount(n)
        print(ans)
        
main()
### BUGGY CODE ###

from math import sqrt

I_list=[]

#input syutoku

while True:

	try:

		k=int(input())

		I_list.append(k)

	except:

		break



I_max=max(I_list)

#create list (I_max=100 -> [3,5,7,...,99])

odd_list=[x for x in range(3,I_max+1,2)]

#print(W_list)



P_list=[2]



p=0

#print(I_list)

ct=0

while p<=int(sqrt(I_max)):

	p=odd_list.pop(0)

	P_list.append(p)

	P_baisuu=[p*x for x in range(1, int(I_max/p) +1 )]

	K_list=set(odd_list)-set(P_baisuu)

	odd_list=sorted(list(K_list))

#	print("P_list=")

#	print(P_list)

#	print("odd_list=")

#	print(odd_list)



prime_list=P_list+odd_list

#print("prime_list=")

#print(prime_list)



for i in I_list:

	w=[j for j in prime_list if j<=i ]

	print(len(w)) 

### FIXED CODE ###

from math import sqrt
I_list=[]
prime_list=[]
while True:
	try:
		I_list.append(int(input()))
	except:
		break
I_max=max(I_list)
search_set={x for x in range(2,I_max+1)}


p=-1
while p<=sqrt(I_max):
	p=min(search_set)
	prime_list.append(p)
	search_set={x for x in search_set if x%p !=0 }

search_list=sorted(list(search_set))
prime_list+=search_list

#print(prime_list)


for i in I_list:
	lower_set={j for j in prime_list if j<=i } 
#	print(lower_set)
	print(len(lower_set))
### BUGGY CODE ###

n, k = map(int, input().split())
p = map(int, input().split())
p_e = [ (x + 1) * 0.5 for x in p]
e_sum = [sum(p_e[i:i+k]) for i in range(n - k + 1)]
print(max(e_sum))

### FIXED CODE ###

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

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n+1)]
print(max(e_sum))
### BUGGY CODE ###

from sys import stdin


def get_result(data):
    S = data[0]
    int_S = int(S)
    mod_all_bit = [0]
    for i in range(len(S)):
        mod_all_bit.append(int_S % (10**(i+1)) % 2019)
    couter = {}
    for key in mod_all_bit:
        couter[key] = 0
    for key in mod_all_bit:
        couter[key] += 1
    ans = 0
    for key, val in couter.items():
        if val >= 2:
            ans += int(val * (val-1) * 0.5)
    return ans


if __name__ == '__main__':
    data = list(map(str, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)


### FIXED CODE ###

from sys import stdin


def get_result(data):
    S = data[0]
    mod_all_bit = [0] * 2019
    mod_all_bit[0] = 1
    # 10**i の mod を漸化式的に事前計算
    # こうすることで計算が効率化できる
    ten_i_mod = [0] * len(S)
    ten_i_mod[0] = 1
    for i in range(len(S)-1):
        ten_i_mod[i+1] = (ten_i_mod[i] * 10) % 2019
    mod = 0
    for i in range(len(S)):
        mod = (mod + ten_i_mod[i] * int(S[-(i+1)])) % 2019
        mod_all_bit[mod] += 1
    ans = 0
    for val in mod_all_bit:
        if val >= 2:
            ans += val * (val-1) * 0.5
    return int(ans)


if __name__ == '__main__':
    data = list(map(str, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)
### BUGGY CODE ###

def main():
    n = int(input())
    a = list(map(int,input().split()))
    temp = 1
    for n in a:
        temp *= n
    if temp > (10 ** 18):
        temp = -1
    print(temp)

if __name__ == '__main__':
    main()


### FIXED CODE ###


def main():
    n = int(input())
    a = list(map(int,input().split()))
    temp = 1
    if 0 in a:
        temp = 0

    for n in a:
        if temp == -1:
            break
        temp *= n
        if temp > 10 ** 18:
            temp = -1
            break
    print(temp)

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

from collections import defaultdict
import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    PY = [tuple(map(int, input().split())) for _ in range(M)]
    result = [None for _ in range(M)]
    p_city = defaultdict(int)
    for py in sorted(PY, key = lambda x: x[1]):
        p_city[py[0]] += 1
        code = str(py[0]).zfill(6) + str(p_city[py[0]]).zfill(6)
        result[PY.index(py)] = code
    print("\n".join(result))


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    PY = [tuple([i] + list(map(int, input().split()))) for i in range(M)]
    result = []
    p_city = defaultdict(int)
    for py in sorted(PY, key = lambda x: x[2]):
        p_city[py[1]] += 1
        code = str(py[1]).zfill(6) + str(p_city[py[1]]).zfill(6)
        result.append((py[0], code))
    print("\n".join([r[1] for r in sorted(result, key = lambda x: x[0])]))


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

import sys

def main():
    
    # sys.stdin = open('input_b.txt')
    input = sys.stdin.readline

    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))

    dp = [0] + [float('inf')] * (n - 1)
    
    for i in range(1, n):
        for j in range(max(0, i - k), i):
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]))

    print(dp[-1])



if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import numpy as np

def main():

    # sys.stdin = open('input_b.txt')
    input = sys.stdin.readline

    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))

    # dp = [0] + [float('inf')] * (n - 1)
    dp = np.zeros(n, dtype=int)
    h = np.array(h)


    for i in range(1, n):
        start = max(0, i-k)
        
        dp[i] = min(dp[start: i] + np.abs(h[i] - h[start : i]))

    print(dp[n-1])



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


N,K = map(int,input().split())
h = list(map(int,input().split()))

dp = [0]*N
for i in range(1,N):
    dp[i] = dp[i-1]+abs(h[i]-h[i-1])
    for j in range(max(0,i-K),i):
        dp[i] = min(dp[j]+abs(h[i]-h[j]),dp[i])
print(dp[N-1])


### FIXED CODE ###


N,K = map(int,input().split())
h = list(map(int,input().split()))

dp = [0]*N
for i in range(1,N):
    dp[i] = dp[i-1]+abs(h[i]-h[i-1])
    for j in range(max(0,i-K),i):
        dp[i] = min(dp[j]+abs(h[i]-h[j]),dp[i])
print(dp[N-1])
### BUGGY CODE ###

S = list(input())
Q = int(input())

flag = 0
for _ in range(Q):
    q = input()
    if q == "1":
        flag += 1
    else:
        _, t, c = q.split()
        if flag % 2 == 0:
            if t == "1":
                S.insert(0, c)
            else:
                S.append(c)
        else:
            if t == "2":
                S.insert(0, c)
            else:
                S.append(c)

if flag % 2 == 1:
    S.reverse()
print("".join(S))


### FIXED CODE ###

from collections import deque

S = list(input())
d = deque(S)
Q = int(input())

flag = 0
for _ in range(Q):
    q = input()
    if q == "1":
        flag += 1
    else:
        _, t, c = q.split()
        if flag % 2 == 0:
            if t == "1":
                d.appendleft(c)
            else:
                d.append(c)
        else:
            if t == "2":
                d.appendleft(c)
            else:
                d.append(c)

if flag % 2 == 1:
    d.reverse()
print("".join(list(d)))
### BUGGY CODE ###

# ABC 155 C
import numpy as np
N = int(input())
S = [str(input()) for i in range(N)]
S = np.array(S)
 
uni = np.unique(S) # return_counts is not available in numpy 1.8.2
count = np.array([np.sum((S==element)) for element in uni])

max_list = np.argwhere(count==np.max(count))
for index in max_list:
    print(str(uni[index][0]))

### FIXED CODE ###

# ABC 155 C
from collections import Counter
import numpy as np
N = int(input())
S = [str(input()) for i in range(N)]
S = np.array(S)

count = Counter(S)
max_num = max(count.values())
max_list = [i for i,j in count.items() if j==max_num]

max_list.sort()
print('\n'.join(max_list))
### BUGGY CODE ###

import math

v = int(input())
sum = 0

for i in range(v):
    i += 1
    for j in range(v):
        j += 1
        for k in range(v):
            k += 1
            sum += math.gcd(math.gcd(i, j), k)

print(sum)

### FIXED CODE ###

from math import gcd

v = int(input())
sum = 0

for i in range(1, v + 1):
    for j in range(1, v + 1):
        for k in range(1, v + 1):
            sum += gcd(gcd(i, j), k)

print(sum)
### BUGGY CODE ###

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

n = int(input())

total = 0
while n:
    total += (n % 10)
    n //= 10

if total % 9 == 0:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

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

n = int(input())

if n % 9 == 0:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from bisect import bisect_left
 
n, m, q = map(int, input().split())
LR = [0]*m
for i in range(m):
    LR[i] = list(map(int, input().split()))
P = [0]*q
Q = [0]*q
for i in range(q):
    P[i], Q[i] = map(int, input().split())
 
LR.sort(key=lambda x: x[0])
L = list(map(lambda x: x[0], LR))
 
for i in range(q):
    l = bisect_left(L, P[i])
    r = bisect_left(L, Q[i]+1)-1
    cnt = 0
    for j in range(l, r+1):
        if LR[j][1] <= Q[i]:
            cnt += 1
    print(cnt)

### FIXED CODE ###

from bisect import bisect_left
 
n, m, q = map(int, input().split())
LR = [0]*m
for i in range(m):
    LR[i] = list(map(int, input().split()))
P = [0]*q
Q = [0]*q
for i in range(q):
    P[i], Q[i] = map(int, input().split())
 
LR.sort(key=lambda x: (x[0], x[1]))
L = list(map(lambda x: x[0], LR))
#print(LR)
 
C = [[0]*(n+1) for _ in range(n+1)]
for i in range(1,n+1):
    l = bisect_left(L, i)
    r = bisect_left(L, i+1)-1
    R2 = list(map(lambda x: x[1], LR[l:r+1]))
    #print(l, r, R2)
    for j in range(i,n+1):
        C[i][j] = bisect_left(R2, j+1)
    #print(i, C[i])
 
for i in range(q):
    ans = 0
    for j in range(P[i], Q[i]+1):
        ans += C[j][Q[i]]
    print(ans)