Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    X = [0] * N
    Y = [0] * N
    for i in range(N):
        x, y = MI()
        X[i], Y[i] = x, y

    dct = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j: continue
            xi, yi = X[i], Y[i]
            xj, yj = X[j], Y[j]

            dct[(xi-xj, yi-yj)] += 1
    # print(dct)
    print(N - max(dct.values()))


if __name__ == '__main__':
    solve()



### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    X = [0] * N
    Y = [0] * N
    for i in range(N):
        x, y = MI()
        X[i], Y[i] = x, y

    dct = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j: continue
            xi, yi = X[i], Y[i]
            xj, yj = X[j], Y[j]

            dct[(xi-xj, yi-yj)] += 1
    # print(dct)
    mx = 0
    for d in dct.values():
        mx = max(mx, d)
    print(N - mx)


if __name__ == '__main__':
    solve()
A = int(input())
B = int(input())
if A == B:
	print "EQUAL"
elif A < B:
	print "LESS"
else:
	print "GREATER"

### FIXED CODE ###

A = int(input())
B = int(input())
if A == B:
	print "EQUAL"
elif A < B:
	print "LESS"
else:
	print "GREATER"
n, x = map(int, input().split())
l = list(map(int,iput().split()))
cnt = 1
dis = 0
for i in range(n):
  dis += l[i]
  if dis > x:
    break
  cnt += 1
print(cnt)

### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int,input().split()))
cnt = 1
dis = 0
for i in range(n):
  dis += l[i]
  if dis > x:
    break
  cnt += 1
print(cnt)
import heapq as hq

def get_num():
    return list(map(int,input().split(' ')))

def main():
    n,m = get_num()
    card = get_num()
    card_sum=sum(card)
    hq.heapify(card)
    d_set=[]
    d=[]
    for i in range(m):
        b,c=get_num()
        hq.heappush(d_set,(-c,b))
    for i in range(m):
        if len(d) ==n:
            break
        cnt = hq.heappop(d_set)
        for i in range(cnt[1]):
            d.append(-cnt[0])
            if len(d)==n:
                break
    for i in range(n):
        c_min=hq.heappop(card)
        d_max=d[i]
        if c_min>=d_max:
            break
        else:
            card_sum += (d_max-c_min)
    print(card_sum)
main()

### FIXED CODE ###

import heapq as hq

def get_num():
    return list(map(int,input().split(' ')))

def main():
    n,m = get_num()
    card = get_num()
    card_sum=sum(card)
    hq.heapify(card)
    d_set=[]
    d=[]
    for i in range(m):
        b,c=get_num()
        hq.heappush(d_set,(-c,b))
    for i in range(m):
        if len(d) ==n:
            break
        cnt = hq.heappop(d_set)
        for i in range(cnt[1]):
            d.append(-cnt[0])
            if len(d)==n:
                break
    for i in range(len(d)):
        c_min=hq.heappop(card)
        d_max=d[i]
        if c_min>=d_max:
            break
        else:
            card_sum += (d_max-c_min)
    print(card_sum)
main()
list = map(int,raw_input().split())
W = list[0] 
H = list[1] 
x = list[2]
y = list[3]
r = list[4]

if x-r < 0:
    print "No"
elif x + r > W:
    print "No"
elif y-r < 0:
    print "No"
elif y+r > H:
    print "No"
else:
    print "Yes"

### FIXED CODE ###

W,H,x,y,r = [int(i) for i in input().split(" ")]

print("No" if x < r or y < r or x + r > W or y + r > H else "Yes" )
K=input()
A=input()
B=input()

i %= K
for i in range(A,B): 
  if i==0:
    print("OK")


### FIXED CODE ###

K=int(input())
A,B=map(int,input().split())

yn=0
for i in range(A,B+1,1):
    if (i % K) == 0:
        print("OK")
        yn=1
        break
if yn==0:
    print("NG")
ソースコード 

Copy
Copy
side = [int(x) for x in input().split()]
side.sort()
 
print(int(side[0]*side[1]/2))

### FIXED CODE ###

side = [int(x) for x in input().split()]
side.sort()
 
print(int(side[0]*side[1]/2))
a,b = map(input().split())
b = b*100
print(a*b/100)

### FIXED CODE ###

from decimal import Decimal
from fractions import Fraction
a,b = input().split()
print(int(int(a)*Fraction(b)))
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

b = [list(map(int, input().split())) for _ in range(m)]
b.sort(key=lambda x: x[1], reverse=True)

x = 0
for i in range(m):
    for j in range(b[i][0]):
        if (a[x] < b[i][1]):
            a[x] = b[i][1]
            x += 1
print(sum(a))

### FIXED CODE ###

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

b = [list(map(int, input().split())) for _ in range(m)]
b.sort(key=lambda x: x[1], reverse=True)

x = 0
y = 0
for i in range(m):
    for j in range(b[i][0]):
        if (a[x] < b[i][1]):
            a[x] = b[i][1]
            x += 1
            if (x == n):
                y = 1
                break
        else:
            y = 1
            break
    if (y==1):
        break
print(sum(a))
import sys

sys.setrecursionlimit(10000)

n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
x = [(i, xy[i][0]) for i in range(n)]
y = [(i, xy[i][1]) for i in range(n)]

x.sort(key = lambda x:x[1])
y.sort(key = lambda x:x[1])

x_dif = [((x[i][0], x[i+1][0]), abs(x[i+1][1]-x[i][1])) for i in range(n-1)]
y_dif = [((y[i][0], y[i+1][0]), abs(y[i+1][1]-y[i][1])) for i in range(n-1)]

xy_dif = x_dif + y_dif
xy_dif.sort(key = lambda x:x[1])

p = [-1]*n

def root(x):
  if p[x]<0:
    return x
  p[x] = root(p[x])
  return p[x]

ans = 0
for ab, cost in xy_dif:
  a, b = ab
  #print(a, b, p[a], p[b], p)
  if root(a)!=root(b):
    p[root(a)] = root(b)
    ans += cost

print(ans)


### FIXED CODE ###

import sys

sys.setrecursionlimit(2147483647)

n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
x = [(i, xy[i][0]) for i in range(n)]
y = [(i, xy[i][1]) for i in range(n)]

x.sort(key = lambda x:x[1])
y.sort(key = lambda x:x[1])

x_dif = [((x[i][0], x[i+1][0]), abs(x[i+1][1]-x[i][1])) for i in range(n-1)]
y_dif = [((y[i][0], y[i+1][0]), abs(y[i+1][1]-y[i][1])) for i in range(n-1)]

xy_dif = x_dif + y_dif
xy_dif.sort(key = lambda x:x[1])

p = [-1]*n

def root(x):
  if p[x]<0:
    return x
  p[x] = root(p[x])
  return p[x]

ans = 0
for ab, cost in xy_dif:
  a, b = ab
  #print(a, b, p[a], p[b], p)
  if root(a)!=root(b):
    p[root(a)] = root(b)
    ans += cost

print(ans)
import collections

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

maxs = []
for k, v in cnt.items():
  if v > 1:
    maxs.append(k)
    
if len(maxs) > 1:
  maxs.sort()
  if len(maxs[-1]) > 3:
    print(maxs[-1] ** 2)
  else:
    print(maxs[-1] * maxs[-2])

else:
  print(0)

### FIXED CODE ###

import collections

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

maxs = []
for k, v in cnt.items():
  if v > 1:
    maxs.append(k)
    
if len(maxs) > 1:
  maxs.sort()
  if cnt[maxs[-1]] > 3:
    print(maxs[-1] ** 2)
  else:
    print(maxs[-1] * maxs[-2])

else:
  print(0)
import numpy as np

stdin = np.fromstring(open(0).read(), np.int64, sep=' ')
N = stdin[0]
XL = stdin[1:N].reshape(-1, 2).T
x = XL[0]
l = XL[1]
arg = np.argsort(x)
x = x[arg]
l = l[arg]

count = 0
i = 0
while i < N - 1:
    for j in range(i + 1, N):
        if x[i] + l[i] > x[j] - l[j]:
            count += 1
        else:
            i = j
            break
    else:
        break
print(N - count)


### FIXED CODE ###

import numpy as np

stdin = np.fromstring(open(0).read(), np.int64, sep=' ')
N = stdin[0]
XL = stdin[1:].reshape(-1, 2).T
x = XL[0]
l = XL[1]
arg = np.argsort(x)
x = x[arg]
l = l[arg]
xleft = x - l
xright = x + l

count = 0
i = 0
while i < N - 1:
    for j in range(i + 1, N):
        if xright[i] > xright[j]:
            count += 1
            i = j
            break
        if xright[i] > xleft[j]:
            count += 1
            j = j + 1
        else:
            i = j
            break
    else:
        i = N - 1

print(N - count)
import math

def comb(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


n, k = map(int, input().split())
for i in range(1, k+1):
	dis = k - i
	cnt = comb(n-k+1, i)
	for j in range(i, 1, -1):
		cnt *= comb(j, j-dis)
	print(cnt%(10**9+7))


### FIXED CODE ###

from operator import mul
from functools import reduce


def comb(n, r):
    r = min(n-r,r)
    if r == 0:
      return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

  
n, k = map(int, input().split())
for i in range(1, k+1):
	if n-k+1 >= i:
		cnt = comb(n-k+1, i) * comb(k-1, i-1)
		print(cnt%(10**9+7))
	else:
		print(0)
n = int(input())
g = [[-1] * n] * n

for i in range(n):
	a = int(input())
	for _ in range(a):
		x, y = map(int, input().split())
		g[i][x-1] = y

ans = 0
for s in range(2**n):
	ok = True
	for i in range(n):
		if (s>>i&1) == 1:
			for j in range(n):
				if g[i][j] != -1 and (s>>j&1) != g[i][j]:
                    ok = False
	if ok:
		ans = max(ans, bin(s).count("1"))

print(ans)


### FIXED CODE ###

n = int(input())

g = [[-1 for j in range(n)] for i in range(n)]

for i in range(n):
	a = int(input())
	for _ in range(a):
		x, y = map(int, input().split())
		g[i][x-1] = y

ans = 0
for s in range(2**n):
	ok = True
	for i in range(n):
		if (s>>i&1) == 1:
			for j in range(n):
				if g[i][j] == -1: continue
				if (s>>j&1) != g[i][j]: ok = False
	if ok:
		ans = max(ans, bin(s).count("1"))

print(ans)
whatMan = []

N, K = input().split()
for i in range(int(K)):
    whatMan.extend(input().split())
print(int(N) - set(whatMan).count)

### FIXED CODE ###

whatMan = []

N, K = input().split()
for i in range(int(K)):
    input()
    whatMan.extend(input().split())
print(int(N) - len(set(whatMan)))
a,b = map(int,input().split())
if n == 100:
    print(101 * (100**d))
else:
    print(n * (100**d))

### FIXED CODE ###

d,n = map(int,input().split())
if n == 100:
    print(101 * (100**d))
else:
    print(n * (100**d))
x = list(map(int, input().split()))
if x.count[5] == 2 and x.count[7] == 1:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

x = list(map(int, input().split()))
if x.count(5) == 2 and x.count(7) == 1:
    print("YES")
else:
    print("NO")
n, m = map(int,input().split())

lefts = [0] * m
rights = [0] * m

for i in range(m):
	l, m = map(int,input().split())
	lefts[i] = l
	rights[i] = r

lefts_max = max(lefts)
rithts_min = min(rights)

result = rights_min - lefts_max + 1

print(max(result,0))



### FIXED CODE ###

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

lefts = [0] * m
rights = [0] * m

for i in range(m):
	l, r = map(int,input().split())
	lefts[i] = l
	rights[i] = r

lefts_max = max(lefts)
rights_min = min(rights)

result = rights_min - lefts_max + 1

print(max(result,0))
n1 = list(map(int, input().split()))
n2 = list(map(int, input().split()))
n3 = list(map(int, input().split()))
arr = []
z=0
for i in range(10):
    arr.append(int(input()))
    if arr[i] == n1[0] or arr[i] == n1[1] or arr[i] == n1[2] or arr[i] == n2[0] or arr[i] == n2[1] or arr[i] == n2[2] or arr[i] == n3[0] or arr[i] == n3[1] or arr[i] == n3[2]:
        z+=1
if z >= 3: print("Yes")
else: print("No")

### FIXED CODE ###

row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))
n = int(input())
arr = []
for i in range(n):
    temp = int(input())
    arr.append(temp)
#
if row1[0] in arr and row1[1] in arr and row1[2] in arr or row2[0] in arr and row2[1] in arr and row2[2] in arr or row3[0] in arr and row3[1] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[0] in arr and row3[0] in arr or row1[1] in arr and row2[1] in arr and row3[1] in arr or row1[2] in arr and row2[2] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[1] in arr and row3[2] in arr or row1[2] in arr and row2[1] in arr and row3[0] in arr:
    print("Yes")
    exit()
else:
    print("No")
a,b = map(int,raw_input().split())
s = a * b
shu = a * 2 + b * 2
fmt = "{s} {shu}"
s = fmt.format(s = s,shu = shu)
print(s)

### FIXED CODE ###

a,b = list(map(int, input().split()))

s = a * b
shu = a * 2 + b * 2
fmt = "{s} {shu}"
s = fmt.format(s = s,shu = shu)
print(s)
import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    if dic[0]!=1:
        ans=False
        print(0)
    for c in range(2,n-1,2):
        if dic[c]!=2:
            ans=False
            break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans and n!=0:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)
  

### FIXED CODE ###

N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
    if len(l)!=len(set(l))*2:
        a=0
else:
    if l.count(0) == 1:
        l.remove(0)
        if len(l) != 2*len(set(l)):
            a = 0
    else:
        a=0
if a:
      print((2**(N//2))%(10**9+7))
else:
      print(0)
N, M = map(int, raw_input().split())

res = 1
for i in range(1, N + 1):
	if i > M * M:
		break
	iif M % i != 0:
		continue
	j = M / i
	if i * N <= M:
		res = max(res, i)
	if j * N <= M:
		res = max(res, j)
print res


### FIXED CODE ###

import math
N, M = map(int, raw_input().split())

MAX_RES = int(math.sqrt(M))
res = 1
for i in range(1, MAX_RES + 1):
	if i * i > M:
		break
	if M % i != 0:
		continue
	j = M / i
	if i * N <= M:
		res = max(res, i)
	if j * N <= M:
		res = max(res, j)
print res
a = input()  
b = input()
print a * b, 2*a + 2*b

### FIXED CODE ###

n = raw_input() 
a = n.split(" ")
print int(a[0]) * int(a[1]) , int(a[0]) * 2 + int(a[1]) * 2
from sys import (stdin, stout)

CORR_TAB = {
  'A': 'T',
  'T': 'A',
  'G': 'C',
  'C': 'G'',
}

for line in stdin:
  stdout.write(CORR_TAB[line.strip()] + '\n')

### FIXED CODE ###

from sys import (stdin, stdout)

CORR_TAB = {
  'A': 'T',
  'T': 'A',
  'G': 'C',
  'C': 'G',
}

for line in stdin:
  stdout.write(CORR_TAB[line.strip()] + '\n')
n, l= (int(x) for x in input().split())
s = list(x for x in input.split())

s.sort()
ans = 0
while range(n + 1):
    ans += s[n]


### FIXED CODE ###

n, l = (int(x) for x in input().split())
s = [input() for a in range(n)]
print("".join(sorted(s)))
import math
A,B = map(int,input().split(" "))
print(int((A * B) / math.gcd(A, B)))

### FIXED CODE ###

import fractions
A,B = map(int,input().split(" "))
print(int((A * B) / fractions.gcd(A, B)))
a, b = map(int, input().split())
if a == 'H' and b == 'H':
    print('H')
elif a == 'H' and b == 'D':
    print('D')
elif a == 'D' and b == 'H':
    print('D')
elif a == 'D' and b == 'D':
    print('H')


### FIXED CODE ###

a, b = map(str, input().split())
if a == 'H' and b == 'H':
    print('H')
elif a == 'H' and b == 'D':
    print('D')
elif a == 'D' and b == 'H':
    print('D')
elif a == 'D' and b == 'D':
    print('H')
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
d = defaultdict(int)
for x in a:
  d[x] += 1
for x in a:
  c = d[x] - 1
  print(c * (c-1) // 2)a

### FIXED CODE ###

from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
d = defaultdict(int)
for x in a:
  d[x] += 1
  
s = 0
for k,v in d.items():
  s += v * (v-1) // 2
for x in a:
  c = d[x] - 1
  print(s - c)
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
answer = 0
cooking_time_order = sorted([A, B, C, D, E], key=lambda x: 10 - (x % 10))
for _ in range(5):
    if cooking_time_order[-1] % 10 == 0:
        answer += cooking_time_order[-1]
        cooking_time_order.pop()
    else:
        break
for cooking_time in cooking_time_order[:-1]:
    answer += (cooking_time + (10 - (cooking_time % 10)))
answer += (cooking_time_order[-1])
print(answer)


### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
answer = 0
cooking_time_order = sorted([A, B, C, D, E], key=lambda x: 10 - (x % 10))
for _ in range(5):
    if cooking_time_order[-1] % 10 == 0:
        answer += cooking_time_order[-1]
        cooking_time_order.pop()
    else:
        break
if len(cooking_time_order) == 0:
    pass
else:
    for cooking_time in cooking_time_order[:-1]:
        answer += (cooking_time + (10 - (cooking_time % 10)))
    answer += (cooking_time_order[-1])
print(answer)
def resolve():
    N = int(input())
    K = -1
    for i in range(1, N+1):
        if (i*(i-1)//2 == N):
            K = i
            break

    if K == -1:
        print("No")
        return
    else:
        S = [[0] * (K-1) for _ in range(K)]
        a = 1
        for i in range(K-1):
            for j in range(i, K-1):
                S[i][j] = a
                S[j+1][i] = a
                a += 1

    print("Yes")
    print(K)
    for s in S:
        print(len(s), *s)

if __name__ == "__main__":
    unittest.main()

### FIXED CODE ###


def resolve():
    N = int(input())
    
    K = 0
    for i in range(1, 1000):
        if (i*(i-1)//2 == N):
            K = i
            break

    if K == 0:
        print("No")
        return
    else:
        S = [[] for _ in range(K)]
        cnt = 1
        for i in range(K):
            for j in range(i+1, K):
                S[i].append(cnt)
                S[j].append(cnt)
                cnt += 1

    print("Yes")
    print(K)
    for s in S:
        print(len(s), *s)

if __name__ == "__main__":
    resolve()
def resolve():
    n = int(input())
	a = list(map(int, input().split()))
	ans = [0]*n
	for i in a:
		ans[i-1] += 1
	for i in ans:
		print(i)
resolve()

### FIXED CODE ###

def resolve():
	n = int(input())
	a = list(map(int, input().split()))
	ans = [0]*n
	for i in a:
		ans[i-1] += 1
	for i in ans:
		print(i)
resolve()
n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []
#チェックする文字をS[0]から取得
for i in S[0]:
    #すべてのSについてチェックする文字の存在判定
    hantei=[]
    for j in range(1,n):
        idx = S[j].find(i)
        hantei.append(idx) #存在する位置をリストに追加
        if idx >= 0: S[j] = S[j][:idx] + S[j][idx+1:] #存在した場合はそれを除去そておく
    if min(hantei) >= 0: ans.append(i)

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)


### FIXED CODE ###

n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []

if n>1:
    #チェックする文字をS[0]から取得
    for i in S[0]:
        #すべてのSについてチェックする文字の存在判定
        hantei=[]
        for j in range(1,n):
            idx = S[j].find(i)
            hantei.append(idx) #存在する位置をリストに追加
            if idx >= 0: S[j] = S[j][:idx] + S[j][idx+1:] #存在した場合はそれを除去そておく
        if min(hantei) >= 0: ans.append(i)
else:
    ans = [i for i in S[0]]

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections


n,m = map(int, input().split())
par = [i for i in range(n)]
rank = [0]*n

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

def main():
    for _ in range(m):
        a,b = map(int, input().split())
        unite(a-1,b-1)

    count = [0]*n
    for p in par:
        count[par(p)] += 1
    print(max(count))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections


n,m = map(int, input().split())
par = [i for i in range(n)]
rank = [0]*n

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

def main():
    for _ in range(m):
        a,b = map(int, input().split())
        unite(a-1,b-1)

    count = [0]*n
    for p in par:
        count[find(p)] += 1
    print(max(count))


if __name__ == '__main__':
    main()
from collections import defaultdict

class Solution:
    def main(self):
        N = int(input())
        self.hashmap = defaultdict(set)
        for i in range(N-1):
            u, v, w = map(int, input().split())
            self.hashmap[u-1].add((v-1, w))
            self.hashmap[v-1].add((u-1, w))
        self.colors = [None] * N
        for i in range(N):
            self.dfs(i, 0)
            print(self.colors[i])

    def dfs(self, i, color):
        if self.colors[i] is None:
            self.colors[i] = color
            for node, weight in self.hashmap[i]:
                if weight % 2 == 0:
                    self.dfs(node, color)
                else:
                    self.dfs(node, 1 ^ color)


if __name__ == '__main__':
    Solution().main()

### FIXED CODE ###

from collections import defaultdict


class Solution:
    def main(self):
        N = int(input())
        self.hashmap = defaultdict(set)
        for i in range(N-1):
            u, v, w = map(int, input().split())
            self.hashmap[u-1].add((v-1, w))
            self.hashmap[v-1].add((u-1, w))
        # print(self.hashmap)
        self.colors = [None] * N
        for i in range(N):
            stack = [(i, 0)]
            while stack:
                idx, color = stack.pop()
                if self.colors[idx] == None:
                    self.colors[idx] = color
                    for node, weight in self.hashmap[idx]:
                        if weight % 2 == 0:
                            stack.append((node, color))
                        else:
                            stack.append((node, 1 ^ color))
        for i in range(N):
            print(self.colors[i])

    def dfs(self, i, color):
        if self.colors[i] is None:
            self.colors[i] = color
            for node, weight in self.hashmap[i]:
                if weight % 2 == 0:
                    self.dfs(node, color)
                else:
                    self.dfs(node, 1 ^ color)


if __name__ == '__main__':
    Solution().main()