Harryxun/stf_run huggingface dataset:
H, W, M = map(int, input().split())
bombs = []
rows = [[]for _ in range(H)]
cols = [[]for _ in range(W)]
for _ in range(M):
    h, w = map(lambda x: int(x)-1, input().split())
    bombs.append((h, w))
    rows[h].append(w)
    cols[w].append(h)

max_row = 0
for i, row in enumerate(rows):
    if max_row < len(row):
        max_row = len(row)
        row_idx = {i}
        continue
    elif max_row == len(row):
        row_idx.add(i)

max_col = 0
for i, col in enumerate(cols):
    if max_col < len(col):
        max_col = len(col)
        col_idx = {i}
        continue
    elif max_col == len(col):
        col_idx.add(i)

ans = max_row+max_col
points = len(row_idx)*len(col_idx)
if M < points:
    print(ans)
else:
    for i, j in bombs:
        if i in row_idx and j in col_idx:
            points -= 1
    if points == 0:
        print(ans-1)
    else:
        print(ans)


### FIXED CODE ###

from itertools import product
h, w, m = map(int, input().split())


row = [set()for _ in range(h)]
col = [set()for _ in range(w)]
for _ in range(m):
    x, y = map(lambda x: int(x)-1, input().split())
    row[x].add(y)
    col[y].add(x)

crow = 0
ic = []
for i, x in enumerate(row):
    if crow < len(x):
        crow = len(x)
        ic = [i]
    elif crow == len(x):
        ic.append(i)

ccol = 0
jc = []
for j, x in enumerate(col):
    if ccol < len(x):
        ccol = len(x)
        jc = [j]
    elif ccol == len(x):
        jc.append(j)


ans = crow+ccol
for i, j in product(ic, jc):
    if j not in row[i]:
        print(ans)
        break
else:
    print(ans-1)
#import numpy as np
import math
#abc_sq = np.sqrt(abc)
d = c - a - b
if 4*a*b < d**2 and d > 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import math
from decimal import Decimal
a, b, c = map(int, input().split())
A = Decimal(str(a))**Decimal('0.5')
B = Decimal(str(b))**Decimal('0.5')
C = Decimal(str(c))**Decimal('0.5')
if A + B < C:
    print('Yes')
else:
    print('No')
import math
a, b, h, m = map(int, input().split())
x = 30 * h + (m * 0.5) % 360
y = m * 6
sa = abs(x - y)
print(x,y,sa)
if a > b:
    c = b
    b = a
    a = c
t = (math.sin(math.radians(sa))) * b
f = math.sqrt(b ** 2 - t ** 2)
if sa >= 180:
    a = -a
print(math.sqrt((f - a) ** 2 + t ** 2))

### FIXED CODE ###

A = input()
if A[-1] == "3":
    print("bon")
elif A[-1] == "0" or A[-1] == "1" or A[-1] == "6" or A[-1] == "8":
    print("pon")
else:
    print("hon")
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))
c1=[0]
c2=[k]
s=0
if n==1:
    ans=0
    if a[0]%k==1:
        ans+=1
    print(ans)
    sys.exit()
for i in range(n):
    s=(s+a[i])%k
    c1.append(s-i-1)
    c2.append(s+k-i-1)
d1={}
for i in range(1,n+1):
    if c1[i] in d1:
        d1[c1[i]]+=1
    else:
        d1[c1[i]]=1
ans=0
for i in range(n):
    if c1[i] in d1:
        ans+=d1[c1[i]]
    d1[c1[i+1]]-=1
d2={}
for i in range(1,min(k,n+1)):
    if c2[i] in d2:
        d2[c2[i]]+=1
    else:
        d2[c2[i]]=1
for i in range(n):
    if c1[i] in d2:
        ans+=d2[c1[i]]
    d2[c2[i+1]]-=1
    if i+k<=n:
        if c2[i+k] in d2:
            d2[c2[i+k]]+=1
        else:
            d2[c2[i+k]]=1
print(ans)










### FIXED CODE ###

import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))
c1=[0]
c2=[k]
s=0
if k==1:
    print(0)
    sys.exit()
for i in range(n):
    s=(s+a[i])%k
    c1.append(s-i-1)
    c2.append(s+k-i-1)
d1={}
for i in range(1,n+1):
    if c1[i] in d1:
        d1[c1[i]]+=1
    else:
        d1[c1[i]]=1
ans=0
for i in range(n):
    if c1[i] in d1:
        ans+=d1[c1[i]]
    d1[c1[i+1]]-=1
d2={}
for i in range(1,min(k,n+1)):
    if c2[i] in d2:
        d2[c2[i]]+=1
    else:
        d2[c2[i]]=1
for i in range(n):
    if c1[i] in d2:
        ans+=d2[c1[i]]
    d2[c2[i+1]]-=1
    if i+k<=n:
        if c2[i+k] in d2:
            d2[c2[i+k]]+=1
        else:
            d2[c2[i+k]]=1
print(ans)
import math
n = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

L = factorization(math.factorial(n))

out = 1
for i in range(len(L)):
  out = out * (L[i][1] + 1)
out = out % (pow(10,9)+7)
print(out)


### FIXED CODE ###

import math
n = int(input())
outlist = [0 for i in range(n+1)]

def isprime(n):
  for i in range(2, int(math.sqrt(n)+1)):
    if n%i == 0:
      return (0)
      break
  return (1)
    
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr 

for i in range(2,n+1):
  L = factorization(i)
  for j in range(len(L)):
    if isprime(L[j][0]) == 1:
      outlist[L[j][0]] += L[j][1]

out = 1
for i in range(len(outlist)):
  out = out * (outlist[i]+1)
print(out % (pow(10,9)+7))
N = int(input())

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

i=0

max = 0
min = 0
for i in range(n):
  if a[i] >= max:
    max = a[i]
  elif a[i] <= min:
    min = a[i]
  else
    continue
    
print (max - min)
  


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
dist = []
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        dist.append(abs(a[i]-a[j]))
print(max(dist))
import sys


def main():
    H, W, M = map(int, sys.stdin.readline().rstrip().split())
    Mh = [0] * H
    Mw = [0] * W
    B = []
    for i in range(M):
        h, w = map(int, sys.stdin.readline().rstrip().split())
        Mh[h - 1] += 1
        Mw[w - 1] += 1
        B.append((h - 1, w - 1))

    nh = max(Mh)
    nw = max(Mw)

    # 交差する場所に置かれた処理物があるか？
    lh = [i for i, v in enumerate(lh) if v == nh]
    lw = [i for i, v in enumerate(lw) if v == nw]

    for h in lh:
        for w in lw:
            if (h, w) not in B:
                print(nh + nw)
                return

    print(nh + nw - 1)


main()


### FIXED CODE ###

import sys
from collections import Counter


def main():
    H, W, M = map(int, sys.stdin.readline().rstrip().split())
    Mh = [0] * H
    Mw = [0] * W
    B = []
    for i in range(M):
        h, w = map(int, sys.stdin.readline().rstrip().split())
        Mh[h - 1] += 1
        Mw[w - 1] += 1
        B.append((h - 1, w - 1))

    nh = max(Mh)
    nw = max(Mw)

    # 交差する場所に置かれた処理物があるか？
    lh = Counter(Mh)[nh]
    lw = Counter(Mw)[nw]

    out = 0
    for (h, w) in B:
        if Mh[h] == nh and Mw[w] == nw:
            out += 1

    if out == lh * lw:
        print(nh + nw - 1)
    else:
        print(nh + nw)


main()
N,M = map(int,input().split())
G = {}
for _ in range(N):
    a,b = map(int,input().split())
    if a not in G:
        G[a] = []
    G[a].append(b)
    if b not in G:
        G[b] = []
    G[b].append(b)
for i in range(1,N+1):
    print(len(G[i]))

### FIXED CODE ###

N,M = map(int,input().split())
G = {}
for _ in range(M):
    a,b = map(int,input().split())
    if a not in G:
        G[a] = []
    G[a].append(b)
    if b not in G:
        G[b] = []
    G[b].append(b)
for i in range(1,N+1):
    if i in G:
    	print(len(G[i]))
    else:
        print(0)
S=input()

def hoge(str):
	if str == "":
		return True
	for word in ["dreamer", "eraser", "dream", "erase"]
		keyword = word.sort(reverse=True)
		pattern = re.compile(r"^%s" % keyword)
		if(str.startswith(keyword)):
			return hoge(str.relpace(pattern, ""))
	return False

if hoge(S.sort(reverse=True)):
	print("YES")
else:
    print("NO")

### FIXED CODE ###

def main():
    S = input()

    while len(S) >= 5:
        if len(S) >= 7 and S[-7:] == "dreamer":
            S = S[:-7]
            continue

        if len(S) >= 6 and S[-6:] == "eraser":
            S = S[:-6]
            continue

        elif S[-5:] == "dream" or S[-5:] == "erase":
            S = S[:-5]
            continue

        else:
            break

    if len(S) == 0:
        print("YES")
    else:
        print("NO")

main()
a, b = input().split()

if a==H and b==H:print(H)
elif a==D and b==D:print(H)
else:print(D)

### FIXED CODE ###

a, b = input().split()

if a=='H' and b=='H':print('H')
elif a=='D' and b=='D':print('H')
else:print('D')
n = input()
num = []
num = input().split(" ")
 
t = 0 
a=0 
while True: 
  num2=[] 
  for i in num: 
    if not (int(i)%2): 
    	a =1 
        break 
    num2.append(int(i)%2) 
  num = num2 
  t+=1 
  if a==1: 
     print(t) 
     break

### FIXED CODE ###

n = input()
num = []
num = input().split(" ")
 
t = 0 
a=0 
while True: 
  num2=[] 
  for i in num: 
    if not int(i)%2==0:
      a =1
      break
    num2.append(int(i)/2)
  num = num2
  if a==1: 
     print(t) 
     break
  t+=1
from math import gcd
a,b=input().strip().split(" ")
a,b=[int(a),int(b)]
c=gcd(a,b)
d=a*b
ans=d//c
print(ans)


### FIXED CODE ###

def gcd(x, y):
# choose the smaller number
    if x > y:
        smaller = y
    else:
        smaller = x
    for i in range(1, smaller+1):
        if((x % i == 0) and (y % i == 0)):
            hcf = i 
    return hcf
a,b=input().strip().split(" ")
a,b=[int(a),int(b)]
c=gcd(a,b)
d=a*b
ans=d//c
print(ans)
n = input()
prices = list()
for idx in range(n):
    tmp = index()
    prices.append(tmp)

minp = prices[0]
maxv = prices[1] - prices[0]

for price in prices:
    maxp = max(maxp, price - min)
    minv = min(minv, price)

print(maxp)


### FIXED CODE ###

n = input()
prices = list()
for idx in range(int(n)):
    tmp = input()
    prices.append(int(tmp))

minp = prices[0]
maxv = prices[1] - prices[0]

for price in prices[1:]:
    maxv = max(maxv, price - minp)
    minp = min(minp, price)

print(maxv)
n, m = map(int, input().split())
ans = [0] * n

for _ in range(m):
    s, c = map(int, input().split())
    if ans[s-1] == 0:
        ans[s-1] = c
    else:
        if not ans[s-1] == c:
            print(-1)
            exit()
tmp = set(ans)
tmp.remove(0)
if n == 1 and m == 0:
    print(0)
elif not tmp:
    print(-1)
else:
    print(*ans, sep='')

### FIXED CODE ###

def solve(n, m):
    ans = [-1] * n
    for _ in range(m):
        s, c = input().split()
        s = int(s) - 1
        if ans[s] == c:
            continue
        elif ans[s] == -1:
            ans[s] = c
        else:
            return -1
 
    if ans[0] == '0':
        if n == 1:
            return '0'
        else:
            return -1
    elif ans[0] == -1:
        if n == 1:
            return '0'
        else:
            ans[0] = '1'
    for i in range(1, n):
        if ans[i] == -1:
            ans[i] = '0'
    return ''.join(ans)
 
 
n, m = list(map(int, input().split()))
print(solve(n, m))
import sys

flag =Fale
A, B = [int(x) for x in input().split()]
for x in range((A+1)*9,(B+1)*10+1):
  if A == x*8//100 and B == x//10:
    print(x)
    flag=True
    break
if not flag:
  print(-1)

### FIXED CODE ###

import sys
A, B = [int(x) for x in input().split()]
for x in range(1010):
  if A == x*8//100 and B == x//10:
    print(x)
    sys.exit()
print(-1)
src = input()
if src[3] == src[4] and src[5] == src[6]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b,c,d,e,f = input()
if c == d and e == f:
  print('Yes')
else:
  print('No')
[a,b,c,d,e,f] = import()

if c = d and e = f:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

[a,b,c,d,e,f] = input()

if c == d and e == f:
    print("Yes")
else:
    print("No")
char(ord(input()) + 1)

### FIXED CODE ###

print(chr(ord(input()) + 1))
print(int((1+int(N))*N/2))

### FIXED CODE ###

N=int(input())
print( int(((1+N)*N)/2) )
a, b, c, d = input().split(" ")
print(abs(a - c) >= d) || (abs(a - b) >= d && abs(b - c) >= d))

### FIXED CODE ###

a, b, c, d = input().split(" ")
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print("Yes")
else:
    print("No")
n = int(input())
s = list(input())
li = []
for i in range(1,n-1):
    li.append(len(set(s[:i+1]) & set(s[i+1:])))
print(max(li))

### FIXED CODE ###

n = int(input())
s = list(input())
li = []
for i in range(1,n-1):
    li.append(len(set(s[:i+1]) & set(s[i+1:])))
print(0 if len(li) == 0 else max(li))
N = int(input())

ans = 0

for i in range(100):
    for j in range(100):
        if (i*4) + (y*7) == N:
            ans = ans+1
            

if ans==0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n=int(input())
for i in range(100):
    for j in range(100):
        if 4*i+7*j==n:
            print("Yes")
            exit(0)
print("No")
a,b=map(str,input().split())
res = ""
if a < b:
  for i in range(b):
    res += a
else:
  for i in range(a):
  res += b
print(res)

### FIXED CODE ###

a,b=map(str,input().split())
res = ""
if a < b:
  for i in range(int(b)):
    res += a
else:
  for i in range(int(a)):
    res += b
print(res)
length= int(input())
num=int(input())
i=0
j=0
p=0
fruits=[]
for i in range(length):
	fruits.append(int(input())
fruits.sort()
for j in range(num):
	p+=fruits[j]
print(p)
# for x in fruits:
# 	print(x)

### FIXED CODE ###

n, k = map(int, input().split())
j=0
p=0
fruits= list(map(int, input().split()))
fruits.sort()
for j in range(k):
	p+=fruits[j]
print(p)
n = input()
if n[2]n[1]n[0] == n:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n = input()
if n[2]+n[1]+n[0] == n:
    print("Yes")
else:
    print("No")
n,m=map(int, input().split())
cnt = [0]*m
for i in range(n):
    like = list(map(int, input().split()))
    k = like.pop(0)
    for j in like:
        cnt[j] += 1

all_like=0
for _ in cnt:
    if _ == n:
        all_like += 1


### FIXED CODE ###

n,m=map(int, input().split())
cnt = [0]*m
for i in range(n):
    like = list(map(int, input().split()))
    k = like.pop(0)
    for j in like:
        cnt[j-1] += 1

all_like=0
for _ in cnt:
    if _ == n:
        all_like += 1
print(all_like)
n,p=map(int,input().split())
S=input()
s=int(s)
ans=0
if p==5:
    for i in range(n):
        if int(S[i])==5 or int(S[i])==0:
            ans+=i+1
elif p==2:
    for i in range(n):
        if int(S[i])%2==0:
            ans+=i+1
else:
    kouho=[0]*p
    for i in range(n):
        a=int(S[-i:])
        a%=p
        kouho[a]+=1
    for j in range(p):
        z=kouho[j]
        ans+=z*(z-1)//2
    ans+=kouho[0]
print(ans)

### FIXED CODE ###

from collections import defaultdict
n,p=map(int,input().split())
S=input()
ans=0
if p==5:
    for i in range(n):
        if int(S[i])==5 or int(S[i])==0:
            ans+=i+1
elif p==2:
    for i in range(n):
        if int(S[i])%2==0:
            ans+=i+1
else:
    kouho=defaultdict(int)
    s=0
    ruijo=1
    for i in range(n):
        ruijo%=p
        s+=int(S[-(i+1)])*(ruijo)
        a=s%p
        kouho[a]+=1
        ruijo*=10
    for j in range(p):
        z=kouho[j]
        ans+=z*(z-1)//2
    ans+=kouho[0]
print(ans)
import sys
import numpy as np
input = sys.stdin.readline

def main():
    n = int(input())
    a = list(map(int,input().split()))

    mod = 10 ** 9 + 7

    a_bin = [format(i, 'b') for i in a]

    m = len(max(a_bin, key = len))

    ans = 0

    for i in range(n):
        a_bin[i] = '0' * (m - len(a_bin[i])) + a_bin[i]

    for i in range(1, m+1):
        count = [0, 0]
        for j in a_bin:
            count[int(j[-i])] += 1
        ans += count[0] * count[1] * 2 ** (i-1)

    print(ans % mod)

def main2():
    n = int(input())
    a = list(map(int,input().split()))

    a = np.array(a)
    ans = 0
    mod = 10**9 + 7

    for i in range(60):
        count = np.count_nonzero(a & 1)
        ans += count * (n - count) * 2 ** i
        a >>= 1

    print(ans % mod)

if __name__ == '__main__':
    main2()


### FIXED CODE ###

import sys
import numpy as np
input = sys.stdin.readline

def main():
    n = int(input())
    a = list(map(int,input().split()))

    mod = 10 ** 9 + 7

    a_bin = [format(i, 'b') for i in a]

    m = len(max(a_bin, key = len))

    ans = 0

    for i in range(n):
        a_bin[i] = '0' * (m - len(a_bin[i])) + a_bin[i]

    for i in range(1, m+1):
        count = [0, 0]
        for j in a_bin:
            count[int(j[-i])] += 1
        ans += count[0] * count[1] * 2 ** (i-1)

    print(ans % mod)

def main2():
    n = int(input())
    a = list(map(int,input().split()))

    a = np.array(a)
    ans = 0
    mod = 10**9 + 7

    for i in range(60):
        count = np.count_nonzero(a & 1)
        ans += count * (n - count) * 2 ** i
        a >>= 1

    print(ans % mod)

if __name__ == '__main__':
    main2()
r = int,input()
area = "{:.6f}".format(π*(r*r))
circumference = "{:.6f}".format(2*π*r)
print(area, circumference)


### FIXED CODE ###

import math
r = float(input())
print((r**2)*math.pi,r*2*math.pi)
q,h,s,d=map(int,input().split())
n=int(input())
a=min(q*4,h*2,s)
b=min(q*8,h*4,s*2,d)
print(min(a*n,a*(n%2)+b*(n//2))

### FIXED CODE ###

q,h,s,d=map(int,input().split())
n=int(input())
a=min(q*4,h*2,s)
b=min(q*8,h*4,s*2,d)
print(min(a*n,a*(n%2)+b*(n//2)))
mochi_list = []
N = int(input())

for i in range(N):
    mochi_list.append(int(input()))

last_mochi = 101
count = 0

for mochi in sorted(mochi_list, reverse=True):
    if mochi < last_mochi:
        count += 1
    last_mochi = mochi

print(count)


### FIXED CODE ###

# -*- coding: utf-8 -*-

from datetime import datetime, timedelta

S = str(input())
wrong_day = datetime.strptime(S, '%Y/%m/%d')
correct_day = wrong_day + timedelta(days=365)
print(correct_day.strftime('%Y/%m/%d'))
a b c = list(map(int, input().split()))
d = c - (a - b)
if d > 0:
  print(d)
else:
  print(0)

### FIXED CODE ###

a, b, c = list(map(int, input().split()))
d = c - (a - b)
if d > 0:
  print(d)
else:
  print(0)
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

n=int(input())
m=n+1
a=list(map(int,input().split()))

# MOD combination
def cmb(n, r, mod=10**9+7):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

N = 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ma=0
dic={}
for i in range(m):
    if not a[i] in dic:
        dic[a[i]]=i
    else:
        ma=i-dic[a[i]]-1

for k in range(1,m+1):
    if k==1:
        print(n)
        continue
    tmp=(cmb(m,k)
    if m-2-ma>=k-1:
        tmp-=cmb(m-2-ma,k-1)
    print(tmp%mod)

### FIXED CODE ###

import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

n=int(input())
m=n+1
a=list(map(int,input().split()))

# MOD combination
def cmb(n, r, mod=10**9+7):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

N = 10**5+10
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ma=0
dic={}
for i in range(m):
    if not a[i] in dic:
        dic[a[i]]=i
    else:
        ma=i-dic[a[i]]-1

for k in range(1,m+1):
    if k==1:
        print(n)
        continue
    tmp=cmb(m,k)
    if m-2-ma>=k-1:
        tmp-=cmb(m-2-ma,k-1)
    print(tmp%mod)
N = int(input())
Alist = list(map(int, input().split()))
V = [0 for v in range(N)]
for i in range(N):
  V[Alist[i]] += i+1

print(' '.join(map(str,V)))


### FIXED CODE ###

N = int(input())
Alist = list(map(int, input().split()))
V = [0]*N
for i in range(N):
  V[Alist[i]-1] += i+1

print(' '.join(map(str,V)))
while True:
    num = int(raw_input())
    if not num:
        break
    data = [raw_input() for _ in range(num)]
    for el in data:
        print(el.replace('Hoshino', 'Hoshina'))

### FIXED CODE ###

[print(input().replace('Hoshino', 'Hoshina')) for _ in range(int(input()))]
L,N=map(int,input().split())
l=[]
for i in range(N):
  l.append(input())
  
l.sort()
print(''.join(l))


### FIXED CODE ###

N,L=map(int,input().split())
l=[]
for i in range(N):
  l.append(input())
  
l.sort()
print(''.join(l))
N = int(input())
A = list(map(int,input().split()))
R = str()

for i in range(1,len(A+1)):
  R += str(A.index(i)+1) + ' '

print(R)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
lst = [0]*len(A)
cnt = 1

for i in A:
  lst[i-1] = str(cnt)
  cnt += 1

print(' '.join(lst))
n = int(input())
int i = 0
List = [input() for i in range(n)]
print(sorted(List))

### FIXED CODE ###

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

dic={}
for i in range(n):
    if s[i] not in dic:
        dic[s[i]]=1
    else:
        dic[s[i]]+=1

largest=max(dic.values())
ans=list()

for key in dic.keys():
    if dic[key]==largest:
        ans.append(key)

ans.sort()
for answers in ans:
    print(answers)
A, B, Q = map(int, input().split())
s = []
t = []
x = []
for _ in range(A):
    s.append(int(input()))
for _ in range(B):
    t.append(int(input()))
for _ in range(Q):
    x.append(int(input()))

import sys
INT_MAX = sys.maxsize
s.insert(0, -1 * INT_MAX)
s.append(INT_MAX)
t.insert(0, -1 * INT_MAX)
t.append(INT_MAX)

import bisect
for xi in x:
    #print(xi)
    si = bisect.bisect_right(s, xi)
    #si = 0
    #for si, v in enumerate(s):
    #    if v > xi:
    #        break
    ti = bisect.bisect_right(s, xi)
    #ti = 0
    #for ti, v in enumerate(t):
    #    if v > xi:
    #        break
    #print(si, ti)
    sa = s[si]
    ta = t[ti]
    sb = s[si-1]
    tb = t[ti-1]
    #print(sa, sb,ta,tb)
    ans = min([
        abs(xi-sa)+abs(sa-ta),
        abs(xi-sa)+abs(sa-tb),
        abs(xi-sb)+abs(sb-ta),
        abs(xi-sb)+abs(sb-tb),
        abs(xi-ta)+abs(ta-sa),
        abs(xi-ta)+abs(ta-sb),
        abs(xi-tb)+abs(tb-sa),
        abs(xi-tb)+abs(tb-sb)
    ])
    print(ans)

### FIXED CODE ###

A, B, Q = map(int, input().split())
s = []
t = []
x = []
for _ in range(A):
    s.append(int(input()))
for _ in range(B):
    t.append(int(input()))
for _ in range(Q):
    x.append(int(input()))

import sys
INT_MAX = sys.maxsize
s.insert(0, -1 * INT_MAX)
s.append(INT_MAX)
t.insert(0, -1 * INT_MAX)
t.append(INT_MAX)

import bisect
for xi in x:
    #print(xi)
    si = bisect.bisect_right(s, xi)
    #si = 0
    #for si, v in enumerate(s):
    #    if v > xi:
    #        break
    ti = bisect.bisect_right(t, xi)
    #ti = 0
    #for ti, v in enumerate(t):
    #    if v > xi:
    #        break
    #print(si, ti)
    sa = s[si]
    ta = t[ti]
    sb = s[si-1]
    tb = t[ti-1]
    #print(sa, sb,ta,tb)
    ans = min([
        abs(xi-sa)+abs(sa-ta),
        abs(xi-sa)+abs(sa-tb),
        abs(xi-sb)+abs(sb-ta),
        abs(xi-sb)+abs(sb-tb),
        abs(xi-ta)+abs(ta-sa),
        abs(xi-ta)+abs(ta-sb),
        abs(xi-tb)+abs(tb-sa),
        abs(xi-tb)+abs(tb-sb)
    ])
    print(ans)
if __name__ == '__main__':
    hight = input().split()
    num = [int(n) for n in hight]
    print(sorted(num, reverse=True)[0])
    print(sorted(num, reverse=True)[1])
    print(sorted(num, reverse=True)[2])



### FIXED CODE ###

num = [int(input()) for i in range(10)]
num.sort(reverse=True)
for i in range(3):
    print(num[i])
n=int(input())
S=input()

ans=[0]*(n+1)
for i,s in S:
  if s=="I":
    ans[i+1]=ans[i]+1
  elif s=="D":
    ans[i+1]=ans[i]-1

print(max(ans))

### FIXED CODE ###

n=int(input())
S=input()

ans=[0]*(n+1)
for i,s in enumerate(S):
  if s=="I":
    ans[i+1]=ans[i]+1
  elif s=="D":
    ans[i+1]=ans[i]-1

print(max(ans))
x=input().split()
y=list(map(int,x))
(i) in sorted(y)
print(i)

### FIXED CODE ###

x=input().split()
y=list(map(int,x))
z=sorted(y)
print("{0} {1} {2}".format(z[0],z[1],z[2]))