N = int(input())
dist_from_1 = [0 for i in range(N+1)]

paths = [dict() for i in range(N+1)]
for i in range(N-1):
    a, b, dist = map(int, input().split())
    paths[a][b] = dist
    paths[b][a] = dist

queue = [(0, 1, 0)]
while len(queue) != 0:
    prev, now, dist = queue.pop()
    dist_from_1[now] = dist
    for next in paths[now]:
        if next == prev:
            continue
        queue.append((now, next, dist + paths[now][next]))

for i in range(1, N+1):
    if dist_from_1[i] % 2 == 0:
        print(0)
    else:
        print(1) N = int(input()) N int(input()) int input() input 0 for i in range(N+1) for i in range(N+1) i range(N+1) range N+1 N 1 for i in range(N+1) 0 dist_from_1 = [0 for i in range(N+1)] dist_from_1 [0 for i in range(N+1)] dict() for i in range(N+1) for i in range(N+1) i range(N+1) range N+1 N 1 for i in range(N+1) dict() dict paths = [dict() for i in range(N+1)] paths [dict() for i in range(N+1)] for i in range(N-1):
    a, b, dist = map(int, input().split())
    paths[a][b] = dist
    paths[b][a] = dist i range(N-1) range N-1 N 1 a, b, dist = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b dist paths[a][b] = dist paths[a][b] [a] paths a b dist paths[b][a] = dist paths[b][a] [b] paths b a dist queue = [(0, 1, 0)] queue [(0, 1, 0)] (0, 1, 0) 0 1 0 while len(queue) != 0:
    prev, now, dist = queue.pop()
    dist_from_1[now] = dist
    for next in paths[now]:
        if next == prev:
            continue
        queue.append((now, next, dist + paths[now][next])) len(queue) != 0 len(queue) len queue 0 prev, now, dist = queue.pop() prev queue.pop() queue.pop queue pop now dist dist_from_1[now] = dist dist_from_1[now] dist_from_1 now dist for next in paths[now]:
        if next == prev:
            continue
        queue.append((now, next, dist + paths[now][next])) next paths[now] paths now if next == prev:
            continue
         next == prev next prev continue queue.append((now, next, dist + paths[now][next])) queue.append queue append (now, next, dist + paths[now][next]) now next dist + paths[now][next] dist paths[now][next] [now] paths now next for i in range(1, N+1):
    if dist_from_1[i] % 2 == 0:
        print(0)
    else:
        print(1) i range(1, N+1) range 1 N+1 N 1 if dist_from_1[i] % 2 == 0:
        print(0)
    else:
        print(1) dist_from_1[i] % 2 == 0 dist_from_1[i] % 2 dist_from_1[i] dist_from_1 i 2 0 print(0) print 0 print(1) print 1 dist = map(int, input().split()) map(int, input().split()) dist paths = [dict() for i in range(N+1)] [dict() for i in range(N+1)] paths now, dist = queue.pop() queue.pop() now queue = [(0, 1, 0)] [(0, 1, 0)] queue N = int(input()) int(input()) N dist = queue.pop() queue.pop() dist dist_from_1 = [0 for i in range(N+1)] [0 for i in range(N+1)] dist_from_1 a, b, dist = map(int, input().split()) map(int, input().split()) a b, dist = map(int, input().split()) map(int, input().split()) b prev, now, dist = queue.pop() queue.pop() prev
N = int(input())
dist_from_1 = [0 for i in range(N+1)]

paths = [dict() for i in range(N+1)]
for i in range(N-1):
    a, b, dist = map(int, input().split())
    paths[a][b] = dist
    paths[b][a] = dist

queue = [(0, 1, 0)]
while len(queue) != 0:
    prev, now, dist = queue.pop()
    dist_from_1[now] = dist
    for next in paths[now]:
        if next == prev:
            continue
        queue.append((now, next, dist + paths[now][next]))

for i in range(1, N+1):
    if dist_from_1[i] % 2 == 0:
        print(0)
    else:
        print(1)
