Harryxun/stf_run huggingface dataset:
N = input()
while True:
    dic = {}
    for i in range(N):
        lis = raw_input().split()
        name = lis[0]
        lis = map(int, lis[1:])
        point = lis[0]*3 + lis[2]
        dic[name] = [point, N-i]
    
    for k, v in sorted(dic.items(), key=lambda x: (x[0][0], x[0][1]), reverse=True):
        print '%s,%s' % (k, v[0])

    N = input()
    if N == 0: break
    print

### FIXED CODE ###

N = input()
while True:
    dic = {}
    for i in range(N):
        lis = raw_input().split()
        dic[lis[0]] = [3*int(lis[1])+int(lis[3]), N-i]
    
    for k, v in sorted(dic.items(), key=lambda x: (x[1][0], x[1][1]), reverse=True):
        print '%s,%s' % (k, v[0])

    N = input()
    if N == 0: break
    print
def d_various_sushi(N, K, Param):
    import heapq

    # 寿司をおいしさの値が大きなものからK個取る
    sushi_parameter = sorted(Param, key=lambda x: x[1], reverse=True)
    sushi_invariably_chosen = []  # ネタが被っていない場合、貪欲に取っていい
    candidate_reject = []  # ネタの種類数を増やす時に取り除く候補(priority queueで管理)
    chosen_topping = set()  # 取った寿司ネタの種類
    for i in range(K):
        t, d = sushi_parameter[i]
        if t not in chosen_topping:
            sushi_invariably_chosen.append(d)
            chosen_topping.add(t)
        else:
            heapq.heappush(candidate_reject, d)

    # 暫定的な最大値を計算しておく
    delicious_sum1 = sum(sushi_invariably_chosen)
    delicious_sum2 = sum(candidate_reject)
    topping_variety = len(chosen_topping)
    ans = delicious_sum1 + delicious_sum2 + topping_variety**2
    if len(candidate_reject) == 0:
        return ans  # 除く寿司の候補がないので、満足度を大きくしようがない

    for i in range(K, N):
        t, d = sushi_parameter[i]
        if t in chosen_topping:
            # ネタが被った上、おいしさがこれまで取った寿司より小さな寿司と交換する理由はない
            continue

        # 取り除いてもネタの種類数が減らない寿司の中で最もおいしさの小さいものを取り除く
        delicious_sum2 -= heapq.heappop(candidate_reject)
        # これまでに取っている寿司にないネタを持ち、最もおいしさの大きい寿司を取る
        chosen_topping.add(t)
        delicious_sum1 += d
        topping_variety += 1

        ans = max(ans, delicious_sum1 + delicious_sum2 + topping_variety**2)
    return ans

N, K = [int(i) for i in input().split()]
Param = [[int(i) for i in input().split()] for j in range(N)]
print(d_various_sushi(N, K, Param))

### FIXED CODE ###

def d_various_sushi(N, K, Param):
    import heapq

    # 寿司をおいしさの値が大きなものからK個取る
    sushi_parameter = sorted(Param, key=lambda x: x[1], reverse=True)
    sushi_invariably_chosen = []  # ネタが被っていない場合、貪欲に取っていい
    candidate_reject = []  # ネタの種類数を増やす時に取り除く候補(priority queueで管理)
    chosen_topping = set()  # 取った寿司ネタの種類
    for i in range(K):
        t, d = sushi_parameter[i]
        if t not in chosen_topping:
            sushi_invariably_chosen.append(d)
            chosen_topping.add(t)
        else:
            heapq.heappush(candidate_reject, d)

    # 暫定的な最大値を計算しておく
    delicious_sum1 = sum(sushi_invariably_chosen)
    delicious_sum2 = sum(candidate_reject)
    topping_variety = len(chosen_topping)
    ans = delicious_sum1 + delicious_sum2 + topping_variety**2

    for i in range(K, N):
        if len(candidate_reject) == 0:
            break  # 除く寿司の候補がないので、満足度を大きくしようがない

        t, d = sushi_parameter[i]
        if t in chosen_topping:
            # ネタが被った上、おいしさがこれまで取った寿司より小さな寿司と交換する理由はない
            continue

        # 取り除いてもネタの種類数が減らない寿司の中で最もおいしさの小さいものを取り除く
        delicious_sum2 -= heapq.heappop(candidate_reject)
        # これまでに取っている寿司にないネタを持ち、最もおいしさの大きい寿司を取る
        chosen_topping.add(t)
        delicious_sum1 += d
        topping_variety += 1

        ans = max(ans, delicious_sum1 + delicious_sum2 + topping_variety**2)
    return ans

N, K = [int(i) for i in input().split()]
Param = [[int(i) for i in input().split()] for j in range(N)]
print(d_various_sushi(N, K, Param))
import math
# def gcd(x, y):
#     while y:
#         amari = x % y
#         x = y
#         y = amari
#     return x

def gcd_list(numbers, maxv):
    gcdv = numbers[0]
    if len(numbers) == 1:
        return gcdv
    for n in range(1, len(numbers)):
        gcdv = math.gcd(gcdv, numbers[n])
        if maxv > gcdv:
            return maxv
        else:
            maxv = gcdv
    return maxv

def main():
    n = int(input())
    a = [int(a) for a in input().split()]

    maxv = 0
    for nn in range(n):
        maxv = gcd_list(a[:nn]+a[nn+1:], maxv)
    print(maxv)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import math
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MAT(h): return [list(map(int, input().split())) for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = INT()
    A = LIST()
    L = [0] * N
    R = [0] * N
    M = [0] * N
    for i in range(N - 1):
        L[i + 1] = gcd(L[i], A[i])
        R[N - i - 2] = gcd(R[N - i - 1], A[N - i - 1])
    maxv = 0
    for i in range(N):
        M[i] = gcd(L[i], R[i])
        if maxv < M[i]:
            maxv = M[i]
    print(maxv)

if __name__ == '__main__':
    main()
num = [int(e) for e in input().split()]
N=num[0]
K=num[1]
if B%A==0:
    print(0)
else:
    print(1)

### FIXED CODE ###

num = [int(e) for e in input().split()]
N=num[0]
K=num[1]
if N%K==0:
    print(0)
else:
    print(1)
a, b, t = map(float(input().split()))
answer = int((t + 0.5) / a) * b
print(answer)

### FIXED CODE ###

A, B, T = list(map(int, input().split()))

ans = T//A * B
print(ans)
import fractions
from functools import reduce


def lcm_list(numbers):
    return reduce(fractions.lcm, numbers)

N = int(input())

t = []
for _ in range(N):
  t.append(int(input()))

print(lcm_list(t))

### FIXED CODE ###

import fractions
from functools import reduce
 
  
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
def lcm_list(numbers):
    return reduce(lcm, numbers)
 
N = int(input())
 
t = []
for _ in range(N):
  t.append(int(input()))
 
print(lcm_list(t))
a, b, k = map(int, input())
c = min(a,k)
a -= c
k -= c
b -= min(b, k)
print(a, b)

### FIXED CODE ###

a, b, k = map(int, input().split())
c = min(a,k)
a -= c
k -= c
b -= min(b, k)
print(a, b)
n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if b[0]==0:
    k-=1
ans=10**10
if na>=k and na!=0:
    ans=-a[-k]
if nb==0:
    print(-a[-k])
    exit()
if na==0:
    print(b[k-1])
    exit()

for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)


### FIXED CODE ###

n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if 0 in x:
    k-=1
    b=[x[i] for i in range(n) if x[i]>0]
    nb=nb-1

if k==0:
    print(0)
    exit()
ans=10**10
if na>=k:
    ans=-a[-k]

if nb>=k:
    ans=min(ans,b[k-1])

if nb==0:
    print(-a[-k])
    exit()

if na==0:
    print(b[k-1])
    exit()

for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)
a1 = int(input())
b2 = input().split(" ")

def check(a , b):
  score = 1
  now = 10 ** 18
  if '0' in b:
    return print(0)
  else:
    for i in range(a):
      score *= int(b[i])
      if score > 10 ** 18:
        return print(-1)
    
    return print(score)

check(a1 , b2)

### FIXED CODE ###

list = input().split(" ")

a = int(list[0])
b = int(list[1])

print(a * b)
(a, b) = int(input())

if a < b:
   print("a < b")
elif a > b:
   print("a > b")
else:
   print("a == b")

### FIXED CODE ###

x = input().split()
i = list(map(int,x))
a = i[0]
b = i[1]

if a > b:
  print('a > b')
elif a == b:
  print('a == b')
else:
  print('a < b')
#!/usr/bin/python3
# -*- coding: utf-8 -*-

# import numpy as np
# from itertools import *
# from collections import *

# S = input()
# N = int(input())
# K, N = [int(x) for x in input().split()]

N = int(input())

S = []
score = [(0,0)] * N

for n in range(N):
    S.append(input())
    while "()" in S[n]:
        S[n] = S[n].replace("()", "")

    if len(S[n]) >= 1:
        beg = S[n].count("(")
        end = S[n].count(")")

        if S[n][0] == "(":
            score[n] = (0, beg)
        else:
            score[n] = (-end, beg)
    else:
        score[n] = (0, 0)

score.sort(reverse=True)

cr = 0
for n in range(N):
    if score[n][0] == 0:
        cr += score[n][1]

for n in range(N):
    if score[n][0] > 0:
        if cr - score[n][0] < 0:
            print("No")
            exit(0)
        cr += sum(score[n])

for n in range(N):
    if score[n][0] < 0:
        cr += sum(score[n])
        if cr < 0:
            print("No")
            exit(0)

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


### FIXED CODE ###

#!/usr/bin/python3
# -*- coding: utf-8 -*-

# import numpy as np
# from itertools import *
# from collections import *

# S = input()
# N = int(input())
# K, N = [int(x) for x in input().split()]

S = input()

T = input()

if T[0:len(S)] == S and len(S) + 1 == len(T):
    print("Yes")
else:
    print("No")
n = 0
while 1:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    else:
        for i in range(1, a+1):
            for j in range(1, i):
                for k in range(1, j):
                    if i + j + k = b:
                        n += 1
        print(n)
        


### FIXED CODE ###

while True:
  n, x = map(int, input().split())
  if n==0 and x==0:
    break
  ans = 0
  for i in range(1, n-1):
      for j in range(i+1, n):
          for k in range(j+1, n+1):
              if i+j+k==x:
                  ans+=1
  print(ans)
s=input()
ans=0
for i in range(0,len(s)-1):
  if s[i]=s[i+1]:
    ans+=1
  else:
    ans+=0

if ans==0:
  print("Good")
else:
  print("Bad")

### FIXED CODE ###

s=input()
ans=0
for i in range(0,3):
  if s[i]==s[i+1]:
    ans+=1
  else:
    ans+=0

if ans==0:
  print("Good")
else:
  print("Bad")
a = 0
yama = []
pop_block = ''
while True:
	x = map(str,raw_input().split(' '))
	if x[0] == 'quit':
		break
	elif x[0] == 'push':
		yama.append(x[1])
		a += 1
		continue
	elif x[0] == 'pop':
		pop_block.append(yama[a])
		yama.remove[a]
		a -= 1
		continue
for val in yama:
print val

### FIXED CODE ###

a = 0
yama = []
pop_block = []
while True:
	x = map(str,raw_input().split(' '))
	if x[0] == 'quit':
		break
	elif x[0] == 'push':
		yama.append(x[1])
		a += 1
		continue
	elif x[0] == 'pop':
		pop_block.append(yama[a-1])
		yama.remove(yama[a-1])
		a -= 1
		continue
for val in pop_block:
	print val
def visit(u):
    global visit_color, d, f, t
    color[u] = GRAY
    d[u] += t
    t += 1
    for v in range(n):
        if (M[u][v] == 0):
            continue
        else:
            if (color[v] == WHITE):
                visit(v)
    color[u] = BLACK
    f[u] = t
    t += 1

n = int(input())
M = [[0 for i in range(n)] for i in range(n)]
for i in range(n):
    tmp = list(map(int, input().split()))
    for j in range(tmp[1]):
        M[tmp[0]-1][tmp[j+2]-1] = 1

for u in range(n):
    if (color[u] == WHITE):
        visit(u)
for u in range(n):
    print(str(u+1), str(d[u]), str(f[u]), sep = " ")

### FIXED CODE ###

def dfs(u):
    global dfs_color, d, f, t
    color[u] = GRAY
    d[u] += t
    t += 1
    for v in range(n):
        if (M[u][v] == 0):
            continue
        else:
            if (color[v] == WHITE):
               dfs(v)
    color[u] = BLACK
    f[u] = t
    t += 1

n = int(input())
M = [[False for i in range(n)] for j in range(n)]
for i in range(n):
    tmp = list(map(int, input().split()))
    for j in range(tmp[1]):
        M[tmp[0]-1][tmp[j+2]-1] = True

WHITE = 0
GRAY = 1
BLACK = 2
color = [WHITE for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
t = 1

for u in range(n):
    if (color[u] == WHITE):
        dfs(u)
for u in range(n):
    print(str(u+1), str(d[u]), str(f[u]), sep = " ")
X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())))
Q=sorted(list(map(int,input().split())))
R=sorted(list(map(int,input().split())))
P_=P[A-X:]
Q_=Q[B-Y:]
ans=sum(P_)+sum(Q_)
for i in range(X+Y):
    if len(R)==0 or len(P)+len(Q)==0 or min(P_[0],Q_[0])>R[-1]:
        break
    ans-=min(P_,Q_).pop(0)
    ans+=R.pop(-1)
print(ans)

### FIXED CODE ###

X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())))
Q=sorted(list(map(int,input().split())))
R=sorted(list(map(int,input().split())))
S=sorted(P[A-X:]+Q[B-Y:])
ans=sum(S)
for i in range(min(len(R),len(S))):
    if S[i]<R[-1-i]:
        S[i]=R[-1-i]
    else:
        break
print(sum(S))
while True:
    combNum = 0
    calcResult = 0
    numList1 = list(range(1,n+1,1))
    numList2 = list(range(1,n+1,1))
    numList3 = list(range(1,n+1,1))
    n,x = map(int, input().split())
    if n is x is 0:
        break
    else:
        for index1 in range(n):
            for index2 in range(n):
                for index3 in range(n):
                    #index = [numList1[index1], numList2[index2], numList3[index3]]
                    if numList1[index1] is numList2[index2] or numList1[index1] is numList3[index3] or numList2[index2] is numList3[index3] or numList1[index1] is numList2[index2] is numList3[index3]:
                    #if index.count(numList1[index1])>1 or index.count(numList1[index2])>1 or index.count(numList1[index3])>1:
                        pass                
                    else:
                        if numList1[index1]<numList2[index2]<numList3[index3]:
                            calcResult = numList1[index1] + numList2[index2]+numList3[index3]
                            if calcResult == x:
                                combNum =combNum+1
                        else:
                            pass
print(combNum)


### FIXED CODE ###

dataNum = 0
combNum = [0] * 100
while True:
    n,x=map(int, input().split())
    if n is x is 0:
        break
    else:
        for a in range(1,n-1):
            for b in range(a+1,n):
                for c in range(b+1,n+1):
                    calcResult = a + b + c
                    if calcResult == x:
                        combNum[dataNum] += 1
                    else:
                        pass
    dataNum += 1

for index in range(dataNum):
    print(combNum[index])
a,b=[int(x) for x in input().split()]
if abs(a-b)<=1:
  	print("Brown"):
else:
  	print("Alice")

### FIXED CODE ###

a,b=[int(x) for x in input().split()]
if abs(a-b)<=1:
  	print("Brown")
else:
  	print("Alice")
a = int(input())
b = int(input())
c = int(input())
x = int(input())

comb = 0

for i in range(0,a+1):
  for j in range(0,b+1):
    for k in range(0,c+1):
      total = int(500 * i + 100 * j + 50 * k)
      if total == x:
        comb += 1
print(comb)

### FIXED CODE ###

#87

X = int(input())
A = int(input())
B = int(input())

print((X-A)%B)
#coding:utf-8

def count(a):
	if a == 25:
		print "Christmas"
	elif  a == 24:
		print "Christmas Eve"
	elif  a == 23:
		print "Christmas Eve Eve"
	elif a==22:
		print "Christmas Eve Eve Eve"

if __name__ == "__main__":
    print('入力してください')
    b = input('a = ')
    count(b)    

### FIXED CODE ###

#coding:utf-8
a = int(input())

if a == 25:
	print('Christmas')
if a == 24:
	print('Christmas Eve')
if a == 23:
	print('Christmas Eve Eve')
if a==22:
	print('Christmas Eve Eve Eve')
"""
Match Matching
提出 #4299735 を参考に作成
"""


def solve():
    # 初期値の設定
    num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
    N, M = map(int, input().split())
    A = [int(i) for i in input().split()]
    A.sort(reverse=True)
    # 丁度n本で作成できる最大桁数を格納する.
    # 初期値は -inf (丁度使い切ることは不可能) としておく
    dp = [-1 * float("inf")] * (N + 1)
    # 動的計画法で丁度n本のマッチを使うときに作れる最大桁数を計算する
    dp[0] = 0
    for n in range(1, N + 1):
        for a in A:
            if n - num[a] >= 0:
                # マッチがnum[a]本あるときにaが作れるなら,
                # n - num[a]本の時よりも1桁多く作れるはず.
                # これをすべてのAに対して行い、その中で最大となった桁数を求める.
                dp[n] = max(dp[n], dp[n - num[a]] + 1)
    # print('各本数丁度で作れる最大桁数')
    # print(dp)

    # 回答となる数値を算出
    ans = ''
    for i in range(dp[N]):  # dp[N]桁の数を上位の桁から決定していく
        for a in A:
            # num[a]本使って数を作ったとき,
            # N - num[a] 本で作れる桁数よりも N 本で作れる桁数のほうが1多い場合,
            # numを作っても最終的に作れる数の桁数は変わらない.
            # そのため dp[N] - 1 == dp[N - num[a]] を満たすような最大のAを作り,
            # 作成する数の上位桁に使用すればよい.
            # 同じ本数のマッチを使用する場合はより大きい数を採用する.
            # そのためAはあらかじめ降順にソートしておく.
            if dp[N] - 1 == dp[N - num[a]]:
                ans += str(a)
                N -= num[a]
                break
        # print('現在の残本数', N, '採用された数', a)

    print(ans)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

"""
Match Matching
提出 #4299735 を参考に作成
"""


def solve():
    # 初期値の設定
    num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
    N, M = map(int, input().split())
    A = [int(i) for i in input().split()]
    A.sort(reverse=True)
    # 丁度n本で作成できる最大桁数を格納する.
    # 初期値は -inf (丁度使い切ることは不可能) としておく
    dp = [-1 * float("inf")] * (N + 1)

    # 動的計画法で丁度n本のマッチを使うときに作れる最大桁数を計算する
    dp[0] = 0
    for n in range(1, N + 1):
        for a in A:
            if n - num[a] >= 0:
                # マッチがnum[a]本あるときにaが作れるなら,
                # n - num[a]本の時よりも1桁多く作れるはず.
                # これをすべてのAに対して行い、その中で最大となった桁数を求める.
                dp[n] = max(dp[n], dp[n - num[a]] + 1)
    # print('各本数丁度で作れる最大桁数')
    # print(dp)

    # 回答となる数値を算出
    ans = ''
    for i in range(dp[N]):  # dp[N]桁の数を上位の桁から決定していく
        for a in A:
            # num[a]本使って数を作ったとき,
            # N - num[a] 本で作れる桁数よりも N 本で作れる桁数のほうが1多い場合,
            # numを作っても最終的に作れる数の桁数は変わらない.
            # そのため dp[N] - 1 == dp[N - num[a]] を満たすような最大のAを作り,
            # 作成する数の上位桁に使用すればよい.
            # 同じ本数のマッチを使用する場合はより大きい数を採用する.
            # そのためAはあらかじめ降順にソートしておく.
            # 最初の条件で配列外アクセスを防ぐ
            if N - num[a] > -1 and dp[N] - 1 == dp[N - num[a]]:
                ans += str(a)
                N -= num[a]
                break
        # print('現在の残本数', N, '採用された数', a)

    print(ans)


if __name__ == '__main__':
    solve()
import collections
import sys
input = sys.stdin.readline


class unionFind:
    parent = []

    def __init__(self, N):
        self.parent = [i for i in range(N)]

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            return


N, M, K = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(M)]

CD = [tuple(map(int, input().split())) for i in range(K)]

tableF = collections.defaultdict(set)
tableB = collections.defaultdict(set)


G = unionFind(N)
for a, b in AB:
    G.unite(a, b)

for i in range(N):
    tableF[i].add(i)

F = collections.defaultdict(set)

for i in range(N):
    F[G.root(i)].add(i)
ans = [len(F[G.root(i)]) - 1 for i in range(N)]

for a, b in AB:
    ans[a-1] -= 1
    ans[b-1] -= 1

for c, d in CD:
    if G.same(c-1, d-1):
        ans[c-1] -= 1
        ans[d-1] -= 1

print(*ans)


### FIXED CODE ###


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


class unionFind:
    parent = []
    count = []

    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.count = [1 for i in range(N)]

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            self.count[y] += self.count[x]
            self.count[x] = self.count[y]
            return

    def getCount(self, x):
        self.count[x] = self.count[self.root(x)]
        return(self.count[x])


N, M, K = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(M)]

CD = [tuple(map(int, input().split())) for i in range(K)]

G = unionFind(N)
for a, b in AB:
    G.unite(a, b)

for i in range(N):
    G.root(i)

ans = [G.getCount(i) - 1 for i in range(N)]
# print(ans)
# print(G.count)
for a, b in AB:
    ans[a-1] -= 1
    ans[b-1] -= 1

for c, d in CD:
    if G.same(c, d):
        ans[c-1] -= 1
        ans[d-1] -= 1

print(*ans)
from functools import reduce

def fib_memo(n):
  memo = [0]*(n+1)
  def _fib(n):
    if n <= 1:
      return n
    if memo[n] != 0:
      return memo[n]
    memo[n] = _fib(n-1) + _fib(n-2)
    return memo[n]
  return _fib(n)

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
B = [0]*(M + 1)
for i in range(M+1):
  if i == 0:
    diff = A[i] - 1
    B[0] = fib_memo(diff + 1)
  elif i == M:
    diff = N - A[M - 1] - 1
    B[M] = fib_memo(diff + 1)
  else:
    diff = A[i] - A[i-1] - 2
    if diff < 0:
      B[i] = 0
      break
    B[i] = fib_memo(diff + 1)
Ans = reduce(lambda a, b: a*b, B)
print(Ans % 1000000007)



### FIXED CODE ###

N, M = map(int, input().split())
A = [True] * (N+1)
for _ in range(M):
  idx = int(input())
  A[idx] = False

step = [0] * (N+1)
step[0] = 1
for i in range(1, N+1):
  if A[i]:
    step[i] = step[i-1] + step[i-2]
  else:
    step[i] = 0
print(step[N]%(10**9+7))
n = int(input())
import math
ans = 0
for a in range(1, n):
  ans += math.floor((n - 1) / a)
print(ans)

### FIXED CODE ###

S=list(input())
if S[len(S)-1]=="s":
  S.append("es")
else:
  S.append("s")
s="".join(S)
print(s)
N = input().split()
N.sort()
print(N)

N1 = N[2] + N[1]
print(int(Nmax) + int(N[0]))


### FIXED CODE ###

N = input().split()
N.sort()

Nmax = N[2] + N[1]
print(int(Nmax) + int(N[0]))
i = int(input().replace' ',''))
if i == i ** 0.5 * 2
    print("Yes")
else:
    print("No")

### FIXED CODE ###

i = int(input().replace(' ',''))
if i == int(i ** 0.5) ** 2:
    print("Yes")
else:
    print("No")
a,b = map(int,input().split())
t = 0

for i in range(a,b+1):
    if i % 100 == i // 1000:
        t += 1
    if i % 100 * 10 == i // 1000:
        t += 1

print(t)

### FIXED CODE ###

a = input()
b = input()
c = input()

print(a[0] + b[1] + c[2])