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

n,m = map(int,input().split())
ben = n*(n-1)//2
ans = [ben]
a = []
b = []
for _ in range(m):
  ai,bi = map(int,input().split())
  a.append(ai)
  b.append(bi)
a.reverse()
b.reverse()
con = [[i] for i in range(n+1)]
for i in range(m-1):
  ai = a[i]
  bi = b[i]
  if bi in con[ai]:
    ans.append(ben)
  else:
    ben -= len(con[ai])*len(con[bi])
    ans.append(ben)
    x = list(set(con[ai]+con[bi]))
    for s in x:
      con[s] = x
for j in range(m):
  print(ans[m-1-j])
  

### FIXED CODE ###

n,m = map(int,input().split())
ben = n*(n-1)//2
ans = [ben]
a = []
b = []
for _ in range(m):
  ai,bi = map(int,input().split())
  a.append(ai)
  b.append(bi)
a.reverse()
b.reverse()
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
u = UnionFind(n)
size = [1 for _ in range(n+1)]
for i in range(m):
  ai = a[i]
  bi = b[i]
  if u.same_check(ai,bi):
    ans.append(ben)
    u.union(ai,bi)
  else:
    x = u.find(ai)
    y = u.find(bi)
    ben -= size[x]*size[y]
    ans.append(ben)
    if u.rank[x] < u.rank[y]:
      size[y] = size[x]+ size[y]
    else:
      size[x] = size[x]+size[y]
    u.union(ai,bi)
    
for j in range(m):
  print(ans[m-1-j])
### BUGGY CODE ###

N=int(input())
A=list(map(int, input().split()))
B=[0]*N

for i in range(0,N):
  for j in range(0,N-1):
    if A[j]==i+1:
      B[i]+=1
  print(B[i])

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
ans=[0]*(N+1)

for i in range(0,N-1):
  ans[A[i]]+=1

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

N=int(input())
*L,=map(int,input().split())

L.sort()
from bisect import*
i=0
ans=0
for i in range(N-1):
    for j in range(i+1,N):
        ans+=bisect_left(L[j:],L[i]+L[j])-1

print(ans)

### FIXED CODE ###

N=int(input())
*L,=map(int,input().split())

L.sort()
from bisect import*
i=0
ans=0
while i<N:
    j=i+1
    while j<N:
        ans+=bisect_left(L[j:],L[i]+L[j])-1
        j+=1
    i+=1

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



G = [901,601,301,91,58,31,7,4,1]

def insertion_sort(array,g):
    for i in range(g,len(array)-1):
        v = array[i]
        j = i-g
        while j>=0 and array[j] > v:
            array[j+g] = array[j]
            j = j-g
            array[-1] += 1
        array[j+g] = v

def shell_sort(array,G):
    for i in G:
        insertion_sort(array,i)


n = int(input())
arr = [int(input()) for i in range(n)] + [0]
Gn = [i for i in G if i <= n]


shell_sort(arr,Gn)
print(len(Gn))
print(' '.join([str(i) for i in Gn]))
print(arr[-1])
[print(i) for i in arr[:-1]]

### FIXED CODE ###



G = [120001,60001,30001,15001,3001,901,601,301,91,58,31,7,4,1]

def insertion_sort(array,g):
    for i in range(g,len(array)-1):
        v = array[i]
        j = i-g
        while j>=0 and array[j] > v:
            array[j+g] = array[j]
            j = j-g
            array[-1] += 1
        array[j+g] = v

def shell_sort(array,G):
    for i in G:
        insertion_sort(array,i)


n = int(input())
arr = [int(input()) for i in range(n)] + [0]
Gn = [i for i in G if i <= n]


shell_sort(arr,Gn)
print(len(Gn))
print(' '.join([str(i) for i in Gn]))
print(arr[-1])
[print(i) for i in arr[:-1]]
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N = int(input())
a = list(map(int, input().split()))

# aを2進数化
# 2 ** 29 < 10 ** 9 < 2 ** 30
k = 30 # 2進数変換後の最大桁数
s = a[0]
x_str = ""
for i in range(N-1):
  s = s ^ a[i+1]
for i in range(N-1):
  x = s ^ a[i]
  x_str += str(x) + " "
x_str += str(s ^ a[N-1])
print(x_str)

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
A = list(map(int, input().split()))
s = 0
for a in A:
  s ^= a
ans = list()
for a in A:
  ans.append(s ^ a)
print(" ".join(map(str, ans)))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)

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

AB = [[int(x) for x in input().split()] for _ in range(N-1)]

# print(AB)

# 添字を1からにしたいのでN+1
graph = [[] for _ in range(N+1)]

# 各頂点に隣接する頂点
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

# print(graph)
counter = [0] * (N+1)

# print(counter)

PX = [[int(x) for x in input().split()] for _ in range(Q)]

# 各頂点に点数を足す
for p,x in PX:
  counter[p] += x


def shori(pa,c,val):
  val += counter[c]
  counter[c] = val
  for i in graph[c]:
    if i == pa:
      continue
    shori(c,i,val)
  
shori(0,1,0)
  

print(" ".join(map(str, counter[1:])))




### FIXED CODE ###

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

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

# AB = [[int(x) for x in input().split()] for _ in range(N-1)]

# print(AB)

# 添字を1からにしたいのでN+1
graph = [[] for _ in range(N+1)]

# 各頂点に隣接する頂点
for _ in range(N-1):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

# print(graph)
counter = [0] * (N+1)

# print(counter)

# PX = [[int(x) for x in input().split()] for _ in range(Q)]

# 各頂点に点数を足す
for _ in range(Q):
  p, x = map(int, input().split())
  counter[p] += x


def shori(pa,c,val):
  val += counter[c]
  counter[c] = val
  for i in graph[c]:
    if i == pa:
      continue
    shori(c,i,val)
  
shori(0,1,0)
  

print(" ".join(map(str, counter[1:])))
### BUGGY CODE ###

N = int(input())
Candidate = []

for i in range(N):
  S = input()
  letters = list(S)
  letters.sort()
  S = "".join(letters)
  Candidate.append(S)

counter = 0
for i in range(N):
  for k in range(N-i-1):
    if Candidate[i] == Candidate[i+k+1]:
      counter += 1
print(counter)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N=int(input())
dic={}
sum=0
for i in range(N):
    s=list(input())
    s.sort()
    s = "".join(s)
    if s in dic:
        sum+=dic[s]
        dic[s]+=1
    else:
        dic[s]=1
print(sum)
### BUGGY CODE ###

NK = list(map(int, input().split()))
a = [0]*NK[0]
for i in range(len(a)):
    a[i] = int(input())
a.sort()

b = [0]*NK[1]
offsets = [100]*(NK[0]-NK[1]+1)
for i in range(len(offsets)):
    for j in range(NK[1]):
        b[j] = a[i+j]
    b.sort()
    offsets[i] = b[len(b)-1] - b[0]

print(min(offsets))


### FIXED CODE ###

NK = list(map(int, input().split()))
a = [0]*NK[0]
for i in range(len(a)):
    a[i] = int(input())
a.sort()
N = NK[0]
K = NK[1]

minimum = a[N-1]
for i in range(N-K+1):
    offset = a[i+K-1] - a[i]
    if minimum > offset:
        minimum = offset

print(minimum)
### BUGGY CODE ###

import sys
import math
def input():
    return sys.stdin.readline()[:-1]
n,s=map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353
dp = [[[0 for i in range(2)] for i in range(s+1)]for i in range(n+1)]
dp[0][0][0]=0

for i in range(1,n+1):
    for j in range(s+1):
        if j==0:
            b=1
        else:
            b=0
        dp[i][j][0] += (dp[i-1][j][0]+b)
        dp[i][j][0] %= mod
        dp[i][j][1] += (dp[i-1][j][1]+dp[i-1][j][0]+b)
        dp[i][j][1] %= mod
        if j+a[i-1]<=s:
            dp[i][j+a[i-1]][0] += (dp[i-1][j][0]+b)
            dp[i][j+a[i-1]][0] %= mod
            dp[i][j+a[i-1]][1] += (b+dp[i-1][j][0])
            dp[i][j+a[i-1]][1] %= mod


print(dp[n][s][1])


### FIXED CODE ###

import sys
import math
def input():
    return sys.stdin.readline()[:-1]
n,s=map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353
dp0 = [[0 for i in range(s+1)]for i in range(n+1)]
dp1 = [[0 for i in range(s+1)]for i in range(n+1)]
for i in range(1,n+1):
    for j in range(s+1):
        if j==0:
            b=1
        else:
            b=0
        dp0[i][j] += (dp0[i-1][j]+b)
        dp0[i][j] %= mod
        dp1[i][j] += (dp1[i-1][j]+dp0[i-1][j]+b)
        dp1[i][j] %= mod
        if j+a[i-1]<=s:
            dp0[i][j+a[i-1]] += (dp0[i-1][j]+b)
            dp0[i][j+a[i-1]] %= mod
            dp1[i][j+a[i-1]] += (b+dp0[i-1][j])
            dp1[i][j+a[i-1]] %= mod

        dp0[i][j]%=mod
        dp1[i][j]%=mod

print(dp1[n][s])
### BUGGY CODE ###

import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)

for j in a:
    ans = 0
    for k in c.keys():
        m = c[k]
        if j == k and m >= 3:
            ans += (m-1) * (m-2) // 2
        elif not j == k and m >= 2:
            ans += m * (m-1) // 2
    print(ans)

### FIXED CODE ###

import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
t = 0

for v in c.values():
    t += v * (v-1) // 2
for i in a:
    print(t - (c[i]-1))
### BUGGY CODE ###

#n=int(input())
n,x,y=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

adjl=[[0 for i in range(n)] for j in range(n)]

dic={}

for i in range(n):
    for j in range(i,n):
        #if i>=j:
        #    continue
        dis=j-i
        maybe=abs(x-(i+1))+1+abs(y-(j+1))
        dis=min(dis,maybe)
        adjl[i][j]=dis

for i in range(n):
    for j in range(i,n):
        #if i>=j:
        #    continue
        dis=adjl[i][j]
        dic[dis]=dic.get(dis,0)+1
for k in range(1,n):
    print(dic.get(k,0))


### FIXED CODE ###

#n=int(input())
n,x,y=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

#adjl=[[0 for i in range(n)] for j in range(n)]

dic={}

for i in range(n):
    for j in range(i,n):
        #if i>=j:
        #    continue
        dis=j-i
        maybe=abs(x-(i+1))+1+abs(y-(j+1))
        dis=min(dis,maybe)
        #adjl[i][j]=dis
        dic[dis]=dic.get(dis,0)+1

for k in range(1,n):
    print(dic.get(k,0))
### BUGGY CODE ###

import itertools

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

h = []
[h.append(int(input())) for i in range(N)]

hCombi = list(itertools.combinations(h, K))
hMax = list(map(max, hCombi))
hMin = list(map(min, hCombi))
print(min([hMax[i] - hMin[i] for i in range(len(hMax))]))

### FIXED CODE ###

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

h = []
for i in range(N):
    h.append(int(input()))

h.sort()

minDistance = 10 ** 9
for i in range(0, N - K + 1):
    if h[i + K - 1] - h[i] < minDistance:
        minDistance = h[i + K - 1] - h[i]

print(minDistance)
### BUGGY CODE ###

#!/usr/bin/env python3
from collections import defaultdict
n=int(input())
s=input()
count=0
for le in range(1,n-1):
    mojiretu=defaultdict(tuple)
    for i in range(n-le+1):
        j=i+le
        if mojiretu[s[i:j]]:
            if j <= mojiretu[s[i:j]][0] or mojiretu[s[i:j]][1]<=i:
                count=max(count,j-i)
        else:mojiretu[s[i:j]]=(i,j)
# while True:
#     for i in range(n)
print(count)


### FIXED CODE ###

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

class RollingHash():
    BASE1 = 1007
    BASE2 = 2009
    MOD1 = 1000000007
    MOD2 = 1000000009
 
    def __init__(self, s, opt=2):
        self.n = len(s)
        self.opt = opt
        self.hash1 = [0] * (self.n + 1)
        self.power1 = [1] * (self.n + 1)
        if opt == 2:
            self.hash2 = [0] * (self.n + 1)
            self.power2 = [1] * (self.n + 1)
        for i, e in enumerate(s):
            self.hash1[i + 1] = (self.hash1[i] * self.__class__.BASE1 + ord(e)) % self.__class__.MOD1
            self.power1[i + 1] = (self.power1[i] * self.__class__.BASE1) % self.__class__.MOD1
            if opt == 2:
                self.hash2[i + 1] = (self.hash2[i] * self.__class__.BASE2 + ord(e)) % self.__class__.MOD2
                self.power2[i + 1] = (self.power2[i] * self.__class__.BASE2) % self.__class__.MOD2
 
    def get(self, l: int, r: int):
        res1 = self.hash1[r] - self.hash1[l] * self.power1[r - l] % self.__class__.MOD1
        if(res1 < 0):
            res1 += self.__class__.MOD1
        if self.opt == 2:
            res2 = self.hash2[r] - self.hash2[l] * self.power2[r - l] % self.__class__.MOD2
            if(res2 < 0):
                res2 += self.__class__.MOD2
        return (res1, res2) if self.opt == 2 else res1


    
rh = RollingHash(S, opt=1)

def check(n: int):
    d = dict()
    for i in range(N - n + 1):
        p = rh.get(i, i + n)
        if p in d.keys():
            if(i - d[p] >= n):
                return True
        else:
            d[p] = i
    return False
    
ok, ng = 0, N // 2 + 1
while ng - ok > 1:
    mid = (ok + ng) // 2
    if check(mid):
        ok = mid
    else:
        ng = mid
print(ok)
### BUGGY CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    d = [None]*(2**n)
    d[0] = [a[0], 0, -1, -1]
    ans = 0
    for i, t1 in enumerate(a[1:]):
        i += 1
        t2, t3, t4 = i, -1, -1
        for j in range(len(bin(i))-2):
            k = i & ~(1 << j)
            if k == i:
                continue
            t5, t6, t7, t8 = d[k]
            if t6 not in [t2, t4]:
                if t5 > t1:
                    t1, t2, t3, t4 = t5, t6, t1, t2
                elif t5 > t3:
                    t3, t4 = t5, t6
            if t8 != t4:
                if t7 > t3:
                    t3, t4 = t7, t8
        d[i] = [t1, t2, t3, t4]
        ans = max(ans, t1+t3)
        print(ans)


main()


### FIXED CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    d = [[(j, i), (-1, -1)] for i, j in enumerate(a)]
    ans = 0
    for i in range(1, 2**n):
        (t1, t2), (t3, t4) = d[i]
        for j in range(n):
            (t5, t6), (t7, t8) = d[i & ~(1 << j)]
            if t6 not in [t2, t4]:
                if t5 > t1:
                    t1, t2, t3, t4 = t5, t6, t1, t2
                elif t5 > t3:
                    t3, t4 = t5, t6
            if t8 not in [t2, t4]:
                if t7 > t3:
                    t3, t4 = t7, t8
        d[i] = [(t1, t2), (t3, t4)]
        ans = max(ans, t1+t3)
        print(ans)


main()
### BUGGY CODE ###

X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

import itertools
AB = [a + b for a, b in itertools.product(A,B)]
AB.sort(reverse=True)
ABC = [ab + c for ab, c in itertools.product(AB[:3000],C)]
ABC.sort(reverse=True)
for i in range(K):
    print(ABC[i])


### FIXED CODE ###

X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

import itertools
AB = [a + b for a, b in itertools.product(A,B)]
AB.sort(reverse=True)
ABC = [ab + c for ab, c in itertools.product(AB[:3000],C)]
ABC.sort(reverse=True)
for i in range(K):
    print(ABC[i])
### BUGGY CODE ###

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

d = 1
S1 = ''
S2 = ''
for i in range(n):
    Q = list(input().split())
    if Q[0] == '1':
        d *= -1
    else:
        f = Q[1]
        c = Q[2]
        if f == '1':
            if d == 1:
                S1 += c
            else:
                S2 += c
        else:
            if d == 1:
                S2 += c
            else:
                S1 += c
if d == 1:
    ans = S1[::-1] + S + S2
else:
    ans = S2[::-1] + S[::-1] + S1

print(ans)

### FIXED CODE ###

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

d = 1
S1 = []
S2 = []
for i in range(n):
    Q = list(input().split())
    if Q[0] == '1':
        d *= -1
    else:
        f = Q[1]
        c = Q[2]
        if f == '1':
            if d == 1:
                S1.append(c)
            else:
                S2.append(c)
        else:
            if d == 1:
                S2.append(c)
            else:
                S1.append(c)
if d == 1:
    ans = ''.join(S1[::-1]) + S + ''.join(S2)
else:
    ans = ''.join(S2[::-1]) + S[::-1] + ''.join(S1)

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

import numpy as np
n, k, q = map(int, input().split())
correct = []
orig = np.ones(n) * k
for i in range(q):
    correct.append(int(input()))
for i in correct:
    orig -= 1
    orig[i-1] += 1
for i in orig:
    if i <=0:
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

import numpy as np
n, k, q = map(int, input().split())
correct = []
orig = np.ones(n) * k - q
for i in range(q):
    tmp = int(input())
    orig[tmp-1] += 1
for i in orig:
    if i <=0:
        print("No")
    else:
        print("Yes")
### BUGGY CODE ###

#B
n,k=map(int,input().split())
h_list=list(map(int,input().split()))
h1=abs(h_list[0]-h_list[1])
cst_list=[0,h1]
for i in range(2,n):
    x_list=[]
    for j in range(1,min(i+1,k+1)):
        x=cst_list[i-j]+abs(h_list[i]-h_list[i-j])
        x_list.append(x)
    cst_list.append(min(x_list))
print(cst_list[n-1])    

### FIXED CODE ###

#B
n,k=map(int,input().split())
h_list=list(map(int,input().split()))
h1=abs(h_list[0]-h_list[1])
cst_list=[0,h1]
for i in range(2,n):
    x_list=[]
    for j in range(1,min(i+1,k+1)):
        x=cst_list[i-j]+abs(h_list[i]-h_list[i-j])
        x_list.append(x)
    cst_list.append(min(x_list))
print(cst_list[n-1])
### BUGGY CODE ###

# coding:UTF-8
import sys
from math import factorial

MOD = 998244353
INF = 10000000000

def main():
    n, k = list(map(int, input().split()))  # スペース区切り連続数字
    lrList = [list(map(int, input().split())) for _ in range(k)]  # スペース区切り連続数字(行列)

    s = []
    for l, r in lrList:
        for i in range(l, r+1):
            s.append(i)

    Interm = [0] * (n + 1)
    Interm[0] = 0
    Interm[1] = 1
    for i in range(1, n+1):
        if i >= 2:
            for j in s:
                if n - j >= 1:
                    Interm[i] = (Interm[i] + Interm[i - j]) % 998244353

    result = Interm[n]
    # ------ 出力 ------#
    print("{}".format(result))

if __name__ == '__main__':
    main()


### FIXED CODE ###

# coding:UTF-8
import sys
from math import factorial

MOD = 998244353
INF = 10000000000

def main():
    n, k = list(map(int, input().split()))  # スペース区切り連続数字
    lrList = [list(map(int, input().split())) for _ in range(k)]  # スペース区切り連続数字(行列)

    s = []
    for l, r in lrList:
        for i in range(l, r+1):
            s.append(i)
    s.sort()

    sum = [0] * (n + 1)
    Interm = [0] * (2 * n + 1)
    sum[1] = 1
    for i in range(1, n):
        for j in range(k):
            l, r = lrList[j][0], lrList[j][1]
            Interm[i+l] += sum[i]
            Interm[i+r+1] -= sum[i]
        sum[i+1] = (sum[i] + Interm[i+1]) % MOD

    # result = Interm[n]
    result = (sum[n] - sum[n-1]) % MOD
    # ------ 出力 ------#
    print("{}".format(result))

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

import copy
n = int(input())
a = [int(input()) for i in range(n)]
A = copy.deepcopy(a)
#print(A)
for i in range(n):
    A.pop(i)
    print(max(A))
    A.insert(i,a[i])

### FIXED CODE ###

import copy
n = int(input())
a = [int(input()) for i in range(n)]
b =sorted(a, reverse = True)
#print(b)
#print(a)
for i in range(n):
    if a[i]==b[0]:
        print(b[1])
    else:
        print(b[0])
### BUGGY CODE ###

N=input()
X=len(N)
INF=10**100
dp=[[INF,INF] for i in range(0,X+1)]
dp[0][0]=0
dp[0][1]=1
for j in range(1,X+1):
    dp[j][0]=min(dp[j-1][0]+int(N[j-1])%10,dp[j-1][1]+10-int(N[j-1])%10)
    if int(N[j-1])%10!=9:
        dp[j][1]=min(dp[j-1][1]+9-int(N[j-1])%10,dp[j-1][0]+int(N[j-1])%10+1)
    else:
        dp[j][1]=dp[j-1][1]+9-int(N[j-1])%10
print(dp[X][0])

### FIXED CODE ###

def main():
    N=input()
    X=len(N)
    INF=10**100
    dp=[[INF,INF] for i in range(0,X+1)]
    dp[0][0]=0
    dp[0][1]=1
    for j in range(1,X+1):
        dp[j][0]=min(dp[j-1][0]+int(N[j-1])%10,dp[j-1][1]+10-int(N[j-1])%10)
        if int(N[j-1])%10!=9:
            dp[j][1]=min(dp[j-1][1]+9-int(N[j-1])%10,dp[j-1][0]+int(N[j-1])%10+1)
        else:
            dp[j][1]=dp[j-1][1]+9-int(N[j-1])%10
    print(dp[X][0])

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

n=input()
Numbers = list(map(int,input().split()))
ans=0
while True:
    if all([x%2==0 for x in Numbers]):
        ans+=1
        [t/2 for t in Numbers]
print(ans)

### FIXED CODE ###


n=input()
Numbers = list(map(int,input().split()))
ans=0
while all(x%2==0 for x in Numbers):
    ans+=1
    Numbers=[t/2 for t in Numbers]
print(ans)
### BUGGY CODE ###

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

point_l = [k] * n

for _ in range(q):
  point_l = list(map(lambda x: x-1, point_l))
  ans = int(input())
  point_l[ans-1] += 1

for i in range(n):
  if point_l[i] <= 0:
    print('No')
  else:
    print('Yes')

### FIXED CODE ###

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


point_l = [k-q] * n
for _ in range(q):
 ans = int(input())
 point_l[ans-1] += 1

for i in range(n):
  print('Yes' if point_l[i]>0 else 'No')
### BUGGY CODE ###

N = int(input())
L = [_ for _ in map(int,input().split())]
res = []
for i in range(1,N+1):
    #index iを表示していく。
    student = L.index(i)+1
    res.append(student)
print(' '.join(map(str, res)))
  

### FIXED CODE ###

N = int(input())
L = [_ for _ in map(int,input().split())]
res = []
for student,people in enumerate(L):
    res.append([people,student])
res.sort()
for s in res:
    print(s[1]+1,end = " ")
### BUGGY CODE ###

import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

n,m = li()

cnt = Counter([])
for _ in range(m):
    cnt += Counter(li())
    
exist = True
for v in cnt.values():
    if v%2:
        exist = False
        break

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

### FIXED CODE ###

import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import defaultdict

n,m  = li()
query = []
for _ in range(m):
    mi,ma = li()
    if mi > ma:
        mi,ma = ma,mi
        
    query.append((mi,ma))

root = defaultdict(list)
for l,r in query:
    root[l].append(r)


even = -1
odd = -1
for k, v in root.items():
    if len(v)%2 == 0 and even == -1:
        even = k
        
    elif len(v)%2 == 1 and odd == -1:
        odd = k

# 偶数個つながっているノードをルートに
top = even
dist = [0]*n
for l,r in query:
    if l==top:
        dist[r-1] += 1
    
    elif r==top:
        dist[l-1] += 1
    
    else:
        dist[r-1] += 1
        dist[l-1] += 1
        
exist = False
if top != -1 and all([disti % 2 == 0 for disti in dist]):
    exist = True
    

# 奇数個つながっているノードをルートに
top = odd
dist = [0]*n
for l,r in query:
    if l==top:
        dist[r-1] += 1
    
    elif r==top:
        dist[l-1] += 1
    
    else:
        dist[r-1] += 1
        dist[l-1] += 1
        
if top != -1 and all([disti % 2 == 0 for disti in dist]):
    exist = True

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

H, W, M = map(int, input().split())
h = [0 for i in range(H)]
w = [0 for i in range(W)]
dp = [[0 for i in range(W)] for j in range(H)]

for i in range(M):
    hh, ww = map(int, input().split())
    h[hh - 1] += 1
    w[ww - 1] += 1
    dp[hh - 1][ww - 1] += 1


hhh = max(h)
www = max(w)
hhhh = [i for i, x in enumerate(h) if x == hhh]
wwww = [i for i, x in enumerate(w) if x == www]
check = 0
for i in hhhh:
    for j in wwww:
        if dp[i][j] == 0:
            check = 1
            break
print(hhh + www - (1-check))


### FIXED CODE ###

H, W, M = map(int, input().split())
h = [0 for i in range(H)]
w = [0 for i in range(W)]
DP = set()
for i in range(M):
    hh, ww = map(int, input().split())
    h[hh - 1] += 1
    w[ww - 1] += 1
    DP.add((hh - 1, ww - 1))

hhh = max(h)
www = max(w)
hhhh = [i for i, x in enumerate(h) if x == hhh]
wwww = [i for i, x in enumerate(w) if x == www]
check = 0

for i in hhhh:
    for j in wwww:
        if (i, j) not in DP:
            print(hhh + www)
            exit()
print(hhh + www - 1)