Harryxun/stf_run huggingface dataset:
N = int(input())
Alist = list(map(int, input().split()))
 
a = set(Alist)
if len(a) == 3:
    print('THREE')
else:
    print('FOUR')

### FIXED CODE ###

N = int(input())
Alist = input().split()
 
a = set(Alist)
if len(a) == 3:
    print('Three')
else:
    print('Four')
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
f = open('input.txt', 'r')
sys.stdin = f

N, M = map(int, input().split())
As = list(map(int, input().split()))
d = sum(As)
if N < d:
    print(-1)
else:
    print(N-d)


### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))

d = sum(A)

if N < d:
  print(-1)
else:
  print(N-d)
a,b=map(int ,input().split())
x=int(pow(b,1/a))
x+=1
while x>=1:
    if b%(pow(x,a))==0:
        print(x)
        exit()
    x-=1



### FIXED CODE ###

a,b=map(int ,input().split())
x=int(pow(b,1/a)+0.00001)
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1
N = int(input())
a = []
for i in range(N):
    s, p = input().split()
    p = -int(p)
    a.append(s, p , i + 1)
    
a.sort()

print('\n'.join(str(ai[2]) for ai in a))

### FIXED CODE ###

a, p = map(int, input().split())
print(int((3*a+p)/2))
n=int(input())
a=list(range(n))
b=0
for i in range(n):
  if len(str(a[i]))%2==1:
    b+=1
print(b)


### FIXED CODE ###

a,b,c=map(int,input().split())
d=a-b
e=c-d
if e>=0:
  print(e)
else:
  print(0)
from collections import Counter, defaultdict
N = int(input())
A = [int(i) for i in input().split()]

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

def c(n):
    return f_list[n]//f_list[n-2]//2

m = Counter(A)
ans = defaultdict(int)
s = 0
for x, y in m.items():
    if y == 1:
        ans[x] = 0
    else:
        ans[x] = c(y)
        s += ans[x]
for a in A:
    print(s - (m[a] - 1))

### FIXED CODE ###

from collections import Counter
N = int(input())
A = [int(i) for i in input().split()]

def c(n):
    return n *(n-1) // 2

m = Counter(A)
s = 0
for x, y in m.items():
    if y != 1:
        s += c(y)
for a in A:
    print(s - (m[a] - 1))
while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
       break
    for h in range(H):
        for w in range(W):
            if (h + w) % 2 = 0:
                print('#', end='')
        else:
                print('.', end='')

        print()

        

### FIXED CODE ###

while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
       break

    for h in range(H):
        for w in range(W):
            if (h + w) % 2 == 0:
                print('#', end='')
            else:
                print('.', end='')

        print()
    print()
N = list(int(input()))
answer = "No"

for i in N:
  if i == 7:
    answer = "Yes"

print(answer)

### FIXED CODE ###

N = list((input()))
ans = "No"
 
for i in N:
  if i == "7":
    ans = "Yes"
         
print(ans)
a,b = input().split()
c = a*b
if type(c) == 'int':
    s = c
s,t =c.split('.')
print(s)

### FIXED CODE ###

from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))
S = input()

li = []
cnt = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
    else:
        li.append(cnt)
        cnt = 0

print(max(li))

### FIXED CODE ###

S = input()

li = []
cnt = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
    else:
        li.append(cnt)
        cnt = 0
li.append(cnt)

print(max(li))
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
 
H,W=map(int, input().split())
S = []

S.append(['.']*(W+2))
for _ in range(H):
    S.append(['.']+list(input())+['.'])
S.append(['.']*(W+2))

for i in range(1,W+1):
    for j in range(1,H+1):
        if S[i][j] == "#":
            if S[i-1][j] == "." and S[i+1][j] == "." and  S[i][j-1] == "." and  S[i][j+1]== ".":
                print("No")
                sys.exit()

print("Yes")

### FIXED CODE ###

# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
 
H,W=map(int, input().split())
S = []

S.append(['.']*(W+2))
for _ in range(H):
    S.append(['.']+list(input())+['.'])
S.append(['.']*(W+2))

for i in range(1,H-1):
    for j in range(1,W-1):
        if S[i][j] == "#" and S[i-1][j] == "." and S[i+1][j] == "." and  S[i][j-1] == "." and  S[i][j+1]== ".":
            print("No")
            sys.exit()

print("Yes")
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if (abs(A-B) % abs(W-V)) == 0 and abs(A-B) >= abs((W - V) * T):
    print("YES")
else:
    print("NO")


### FIXED CODE ###

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if V > W and abs(A - B) <= abs((W - V) * T):
    print("YES")
else:
    print("NO")
while True:
    try:
        s=input().split(" ")
        s.sort
        if s[0]**2+s[1]**2=s[2]**:
            print("YES")
        else:
            print("NO")
    except:
        break

### FIXED CODE ###

n=int(input())
for i in range(n):
        s=input().split(" ")
        s=[int(j) for j in s]
        s.sort()
        
        if(s[0]**2+s[1]**2==s[2]**2):
            print("YES")

        else:
            print("NO")
a, b, c, x = [int(input()) for _ in range(4)]
ans = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k == x:
        ans += 1
prit(ans)

### FIXED CODE ###

a, b, c, x = [int(input()) for _ in range(4)]
ans = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k == x:
        ans += 1
print(ans)
n, k = map(int, input().split())
S = input()

compress = []
now = '1'
count = 0
for s in S:
    if s != now:
        compress.append(count)
        now = s
        count = 1
    else:
        count += 1
compress.append(count)

length = len(compress)
candidate = sum(compress[:2*k+1])
ans = candidate
if length <= 2*k+1:
    print(ans)
    exit()

for i in range(0, length-2*k-1, 2):
    if 2+k+2+i < length:
        candidate += compress[2*k+1+i] + compress[2*k+2+i] - compress[i] - compress[i+1]
    else:
        candidate += compress[2*k+1+i] - compress[i] - compress[i+1]
    ans = max(ans, candidate)

print(ans)

### FIXED CODE ###

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

compress = []
now = '1'
count = 0
for s in S:
    if s != now:
        compress.append(count)
        now = s
        count = 1
    else:
        count += 1
compress.append(count)

length = len(compress)
candidate = sum(compress[:2*k+1])
ans = candidate
if length <= 2*k+1:
    print(ans)
    exit()

for i in range(0, length-2*k-1, 2):
    if 2*k+2+i < length:
        candidate += compress[2*k+1+i] + compress[2*k+2+i] - compress[i] - compress[i+1]
    else:
        candidate += compress[2*k+1+i] - compress[i] - compress[i+1]
    ans = max(ans, candidate)

print(ans)
x = input()

if x >= 30:
  print('Yes')
elif x < 30:
  print('No')
else:
  print('No')

### FIXED CODE ###

x = int(input())

if x >= 30:
  print('Yes')
elif x < 30:
  print('No')
n = int(input())
x = list(map(int, input().split()))
x.sort()
sigmaList = list()
for p in range(x[0], x[n - 1]):
    sigma = 0
    for i in range(n):
        sigma += (x[i] - p) ** 2
    sigmaList.append(sigma)

print(min(sigmaList))


### FIXED CODE ###

n = int(input())
x = list(map(int, input().split()))
x.sort()
sigmaList = list()
for p in range(x[0], x[n - 1] + 1):
    sigma = 0
    for i in range(n):
        sigma += (x[i] - p) ** 2
    sigmaList.append(sigma)
print(min(sigmaList))
X,N=map(int,input().split())
if N==0:
    print(X)
    exit()

P_ori=list(map(int,input().split()))
if P_ori.count(X)==0:
    print(X)
    exit()

P1=sorted(P_ori)
N=list(range(1,101))
PZ=[]
for i in range(len(N)):
    if P1.count(N[i])==0:
        PZ.append(N[i])

PZ.append(X)
P2=sorted(PZ)
t=P2.index(X)
if P2[t]==P2[0]:
    print(P2[1])
    exit()
elif P2[t]==P2[-1]:
    print(P2[-2])
    exit()
else:
    dist1=abs(P2[t-1]-P2[t])
    dist2=abs(P2[t]-P2[t+1])
    if dist1<=dist2:
        print(P2[t-1])
        exit()
    else:
        print(P2[t+1])
        exit()
print(0)

### FIXED CODE ###

X,N=map(int,input().split())
if N==0:
    print(X)
    exit()

P_ori=list(map(int,input().split()))
if P_ori.count(X)==0:
    print(X)
    exit()


P1=sorted(P_ori)
N=list(range(0,102))
PZ=[]
for i in range(len(N)):
    if P1.count(N[i])==0:
        PZ.append(N[i])

PZ.append(X)
P2=sorted(PZ)
t=P2.index(X)
if P2[t]==P2[0]:
    print(P2[1])
    exit()
elif P2[t]==P2[-1]:
    print(P2[-2])
    exit()
else:
    dist1=abs(P2[t-1]-P2[t])
    dist2=abs(P2[t]-P2[t+1])
    if dist1<=dist2:
        print(P2[t-1])
        exit()
    else:
        print(P2[t+1])
        exit()
print(0)
print(
  "Yay!"
  if all(lambda x: x <= 8,      
         map(int, input().split())
        )
  else ":("
)

### FIXED CODE ###

print(
  "Yay!"
  if all(map(
    lambda x: x <= 8,      
    map(int, input().split())
  ))
  else ":("
)
INF = 10**10
arr = [INF,2,5,5,4,5,6,3,7,6]
N,M = map(int,input().split())
src = sorted(list(map(int,input().split())))

dp = [-INF]*(N+1)
dp[0] = 0
for i in range(N):
    for j in src:
        if i + arr[j] <= N:
            dp[i + arr[j]] = max(dp[i + arr[j]], dp[i] + 1)
ans = ''
dim = dp[N]
while(dim > 0):
    for i in src[::-1]:
        if dp[N-arr[i]] == dp[N] - 1:
            ans += str(i)
            N -= arr[i]
            break
    dim -= 1
print(ans if ans else 0)

### FIXED CODE ###

INF = 10**10
arr = [INF,2,5,5,4,5,6,3,7,6]
N,M = map(int,input().split())
src = sorted(list(map(int,input().split())))

dp = [-INF]*(N+1)
dp[0] = 0
for i in range(N):
    for j in src:
        if i + arr[j] <= N:
            dp[i+arr[j]] = max(dp[i+arr[j]],dp[i] + 1)
dim = dp[N]
ans  = ''
while(dim > 0):
    for i in src[::-1]:
        if N >= arr[i] and dp[N-arr[i]] + 1 == dp[N]:
            ans += str(i)
            N -= arr[i]
            dim -= 1
            break
print(ans)
N = int(input())
S = []

for i in range(N):
    s = int(input())
    S.append(s)

a = sum(S)

if a % 10 != 0:
    print(a)
else:
    T = [s for s in S if s%10!=0]
    if len(T) == 0:
       ans = 0
    else:
        ans = a-min(T)

print(ans)

### FIXED CODE ###

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

for i in range(N):
    s = int(input())
    S.append(s)

a = sum(S)
ans = 0

if a % 10 != 0:
    ans = a
else:
    T = [s for s in S if s%10!=0]
    if len(T) == 0:
       ans = 0
    else:
        ans = a-min(T)

print(ans)
def main():
  N=int(input())
  A=list(map(int,input().split()))
  B=list(map(int,input().split()))
  tmp={}
  for i in range(N):
    if not B[i] in tmp.keys():
      tmp[B[i]]=[]
    tmp[B[i]].append(A[i])
  A.sort()
  B.sort()
  for i in range(N):
    if A[i]>B[i]:
      print("No")
      return 0
  for i in range(N):
    if A[i] in tmp[B[i]]:
      print("Yes")
      return 0
    if i!=N-1:
      if B[i] >= A[i+1]:
        print("Yes")
        return 0
  print("No")
      
main()


### FIXED CODE ###

N=int(input())
if N%2==0:
  print(N//2-1)
else:
  print(N//2)
a=input()
b=input()
c={}
state=True
for i in range(len(a)):
  if b[i] not in c and a[i] not in c:
    c[b[i]]=a[i]
    c[a[i]]=b[i]
  if c[b[i]]!=a[i]:
    state=False
if state:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a=input()
b=input()
c={}
state=True
for i in range(len(a)):
  if b[i] not in c and a[i] not in c.values():
    c[b[i]]=a[i]
  if b[i] in c:
    if c[b[i]]!=a[i]:
      state=False
  else:
    state=False
if state:
  print('Yes')
else:
  print('No')
N, K = map(int,input().split())
if K == 0 or M ==0:
  li = []
  for i in range(2**N):
    li += [i]*2
  print(' '.join(map(str, li)))
else:
  print(-1)


### FIXED CODE ###

M, K = map(int, input().split())

if K >= 2**M:
    print(-1)
elif M == 0:
    if K == 0:
        print(0,0)
    else:
        print(-1)
elif M == 1:
    if K >= 1:
        print(-1)
    else:
        print(0,0,1,1)
else:
    li = [i for i in range(2**M) if i != K]
    ans = li + [K] + list(reversed(li)) + [K]
    print(*ans)
from collections import deque

h, w = map(int, input().split())
c = [list(input()) for i in range(h)]
ans = -1

def bfs(sx, sy):
    que = deque([[sy, sx]])
    d = [["."] * w for _ in range(h)]
    count = 0
    d[sy][sx] = 0
    while que:
        y, x = que.popleft()
        for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            nx, ny = x+i, y+j
            if 0 <= nx and nx < w and 0 <= ny and ny < h and d[ny][nx] == "." and c[ny][nx] != "#":
                nx_, ny_ = nx-i, ny-j
                d[ny][nx] = d[ny_][nx_] + 1
                que.append([ny, nx])
    return max(max(d))

for i_ in range(h):
    for j_ in range(w):
        if c[i_][j_] == "#":
            continue
        ans = max(ans, bfs( j_, i_))

print(ans)

### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
c = [input() for _ in range(h)]
ans = -1

def bfs(sx, sy):
    que = deque([[sy, sx]])
    d = [[-1] * w for _ in range(h)]
    d[sy][sx] = 0
    res = 0
    while que:
        y, x = que.popleft()
        res = max(res, d[y][x])
        for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            nx, ny = x+i, y+j
            if 0 <= nx and nx < w and 0 <= ny and ny < h and d[ny][nx] == -1 and c[ny][nx] != "#":
                nx_, ny_ = nx-i, ny-j
                d[ny][nx] = d[ny_][nx_] + 1
                que.append([ny, nx])
    return res

for i_ in range(h):
    for j_ in range(w):
        if c[i_][j_] != "#":
            ans = max(ans, bfs( j_, i_))

print(ans)
N = input()
count = 0
COUNT = 0
A = input().split()
while:
  for i in range(N):
    if A[i]%2==0:
      A[i]/=2
      count++
  if count == N:
    COUNT++
  else:
    break
print(COUNT)

### FIXED CODE ###

number = int(input())
count = 0
if number >= 50:
  count += 1
if number%100 >= 5:
  count += 1
if number%10 >= 0.5:
  count += 1
print(count)
a = list(map(int, input().split()))
 
if a[0]>=10 or a[1]>=10:
  return -1
else:
  return a[0]*a[1]

### FIXED CODE ###

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

if a[0]>=10 or a[1]>=10:
    print(-1)
else:
    print(a[0]*a[1])
from collections import deque

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p = deque(p)
q = deque(q)
r = deque(r)

ans = 0
for _ in range(X):
    if p[0] >= r[0]:
        ans += p.popleft()
    else:
        ans += r.popleft()
for _ in range(Y):
    if q[0] >= r[0]:
        ans += q.popleft()
    else:
        ans += r.popleft()

print(ans)


### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p = p[:X]
q = q[:Y]

all = p + q + r
all.sort(reverse=True)
ans = sum(all[:X + Y])
print(ans)
N,M = tuple(map(int,input().split()))
matchlist = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(M)]
#最大のグループの大きさを出す
friendlist = [0 for i in range(N)]
gplist = [[-1]]
def match(ab):
    a,b=ab
    gpa=friendlist[a]
    gpb=friendlist[b]
    if bool(gpa) and gpa==gpb:
        return
    elif not bool(gpa) and not bool(gpb):
        friendlist[a]=len(gplist)
        friendlist[b]=len(gplist)
        gplist.append([a,b])
    elif bool(gpa) and not bool(gpb):
        friendlist[b] = gpa
        gplist[gpa].append(b)
    elif not bool(gpa) and bool(gpb):
        friendlist[a] = gpb
        gplist[gpb].append(a)
    else:
        for i in gplist[gpb]:
            friendlist[i] = gpa
        gplist[gpa].extend(gplist[gpb])
        gplist[gpb] = -1
# print(gplist)
for i in range(M):
    match(matchlist[i])
    # print(gplist)
    # print(friendlist)
print(max([len(item) for item in gplist]))

### FIXED CODE ###

N,M = tuple(map(int,input().split()))
# matchlist = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(M)]
#最大のグループの大きさを出す
friendlist = list(range(N))
# [所属先,[所属メンバー]]
gplist = [[i] for i in range(N)]

def getgroup(a):
    A = friendlist[a]
    if A == a:
        return a
    else:
        return getgroup(A)

def match(ab):
    A = getgroup(ab[0])
    B = getgroup(ab[1])
    if A==B:
        return
    elif len(gplist[A])<len(gplist[B]):
        gplist[B].extend(gplist[A])
        friendlist[A] = B
    else:
        gplist[A].extend(gplist[B])
        friendlist[B] = A

for i in range(M):
    # print(friendlist)
    # print(gplist)
    match(tuple(map(lambda x:int(x)-1,input().split())))

# print(friendlist)
# print(gplist)

print(max([len(item) for item in gplist]))
S=input()
T=input()
ls=len(S)
lt=len(T)

ans='UNRESTORABLE'

if ls<lt:
    print(ans)
    exit()
for i in range(ls-lt,0,-1):
    c=0
    for j in range(lt):
        if T[j]==S[i+j] or S[i+j]=='?':
            continue
        else:
            c=1
            break
    if c==0:
        ans=S.replace('?','a')
        ans=ans[:i] +z T + ans[i+lt:]
print(ans)


### FIXED CODE ###

s_prime=list(input())
t=list(input())
ls=len(s_prime)
lt=len(t)
s_prime.reverse()
t.reverse()


if lt>ls:
    print('UNRESTORABLE')
else:
    def check(t,s):
        l=len(t)
        c=0
        for i in range(l):
            if s[i]!='?' and s[i]!=t[i]:
                c=1
        return True if c==0 else False
    c=0            
    for i in range(ls-lt+1):
        print()
        if check(t,s_prime[i:i+lt])==1:
            t_in=s_prime[:i]+t+s_prime[i+lt:] 
            for k in range(ls):
                if t_in[k]=='?':
                    t_in[k]='a'
            t_in.reverse()   
            print(''.join(t_in))
            c=1
            break
    print('UNRESTORABLE') if c==0 else exit()
def func():
    a = int(input())
    for i in range(1, 10):
        for n in range(1, 10):
            if a == i * n:
                print("Yes")
                return
    print("No")
 
 
func()

### FIXED CODE ###

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

if (a < 10 and a > 0) and (b < 10 and b > 0):
    print(a * b)
else:
    print(-1)
import math
a, b, c, d = map(int, input().split())
if math(c / b) < math(a / d):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import math
a, b, c, d = map(int, input().split())
if math.ceil(c / b) <= math.ceil(a / d):
  print("Yes")
else:
  print("No")
N = int(raw_input())
line = map(int,raw_input().split(' '))
M = int(raw_input())
for i in range(M):
    x = map(int,raw_input().split(' ')
    print sum(line)-(line[x[0]]-x[1])

### FIXED CODE ###

N = int(raw_input())
line = map(int,raw_input().split(' '))
M = int(raw_input())
for i in range(M):
    x = map(int,raw_input().split(' '))
    s = sum(line)-(line[x[0]-1]-x[1])
    print s
from decimal import Decimal
import fractions


N = int(input())

now = Decimal("1")

for i in range(N):

    T = Decimal(input())

    now = now * T / fractions.gcd(now,T)

now = int(now)

print("{:.100g}".format(now))


### FIXED CODE ###

import fractions

N = int(input())

now = 1

for i in range(N):

    T = int(input())

    now = now * T // fractions.gcd(now , T)

print (now)
N = int(input())
d = []
for i in range(N):
    d.append(int(input()))
print(len(set(d)))

### FIXED CODE ###

y,m,d=input().split("/")
y=str(2018)
print(y+"/"+m+"/"+d)
n, m = map(int, input().split())
ans = [1] * (n + 1)
for i in a:
    ans[i] = 0
for i in range(2, n + 1):
    if ans[i]:
        ans[i] = ans[i - 1] + ans[i - 2]
    if ans[i] >= 1000000007:
        ans[i] = ans[i] % 1000000007
print(ans[-1])

### FIXED CODE ###

n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
ans = [1] * (n + 1)
for i in a:
    ans[i] = 0
for i in range(2, n + 1):
    if ans[i]:
        ans[i] = ans[i - 1] + ans[i - 2]
    if ans[i] >= 1000000007:
        ans[i] = ans[i] % 1000000007
print(ans[-1])
class Graph():
	def __init__(self):
		self.adjacency_dict = {}
		self.weight = []

	def add_vartex(self, v):
		self.adjacency_dict[v] = []
		self.weight.append([])

	def add_edge(self, v1, v2, w):
		self.adjacency_dict[v1].append(v2)
		self.adjacency_dict[v2].append(v1)
		self.weight[v1].append(w)
		self.weight[v2].append(w)

	def get_vartexes(self):
		return self.adjacency_dict.keys()

	def get_edges(self, v):
		return self.adjacency_dict[v], self.weight[v]

	def printgraph(self):
		return print(self.adjacency_dict)

n = int(input())

res = []
g = Graph()
for i in range(n):
	res.appned(-1)
	g.add_vartex(i)

for i in range(n-1):
	u, v, w = map(int, input().strip().split())
	g.add_edge(u - 1, v - 1, w % 2)


q = []
res[0] = 0
q.append(0)
while(len(q) > 0):
	v = q.pop()
	u_l, w_l = get_edges(v)
	for u, w in zip(u_l, w_l):
		if res[u] != -1:
			continue
		res[u] = (res[v] + w) % 2
		q.appned(u)

for i in range(n):
	print(res[i])



### FIXED CODE ###

class Graph():
	def __init__(self):
		self.adjacency_dict = {}
		self.weight = []

	def add_vartex(self, v):
		self.adjacency_dict[v] = []
		self.weight.append([])

	def add_edge(self, v1, v2, w):
		self.adjacency_dict[v1].append(v2)
		self.adjacency_dict[v2].append(v1)
		self.weight[v1].append(w)
		self.weight[v2].append(w)

	def get_vartexes(self):
		return self.adjacency_dict.keys()

	def get_edges(self, v):
		return self.adjacency_dict[v], self.weight[v]

	def printgraph(self):
		return print(self.adjacency_dict)

n = int(input())

res = []
g = Graph()
for i in range(n):
	res.append(-1)
	g.add_vartex(i)

for i in range(n-1):
	u, v, w = map(int, input().strip().split())
	g.add_edge(u - 1, v - 1, w % 2)


q = []
res[0] = 0
q.append(0)
while(len(q) > 0):
	v = q.pop()
	u_l, w_l = g.get_edges(v)
	for u, w in zip(u_l, w_l):
		if res[u] != -1:
			continue
		res[u] = (res[v] + w) % 2
		q.append(u)

for i in range(n):
	print(res[i])
line = input()
N, X, T = line.split(" ")

print((N + X - 1) // X * T)

### FIXED CODE ###

line = input()

N, X, T = (int(x) for x in line.split(" "))

print((N + X - 1) // X * T)
num=int(input().split())
if num[0]>num[1]:
    print("a>b")
elif num[0]==num[1]:
    print("a==b")
else:
    print("a<b")

### FIXED CODE ###

num=[int(i) for i in input().split()]
if num[0]>num[1]:
    print("a > b")
elif num[0]==num[1]:
    print("a == b")
else:
    print("a < b")
S=int(input())

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
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 )

if S<3:
    ans=0
n=S//3
ans=0
for i in range(1,n+1):
    ans+=cmb(S-2*

### FIXED CODE ###

S=int(input())

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
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 )

if S<3:
    ans=0
n=S//3
ans=0
for i in range(1,n+1):
    ans+=cmb(S-2*i-1,i-1,mod)
    ans%=mod
print(ans)
input1 = input()
input2 = input()

def match(x, y):
    i = 0
    if x is y:
        i = 1
    return i

result_list = map(match, input1, input2)
print(result_list.count(0))

### FIXED CODE ###

input1 = input()
input2 = input()

def match(x, y):
    i = 0
    if x is y:
        i = 1
    return i

result_list = list(map(match, input1, input2))
print(result_list.count(0))