# -*- coding: utf-8 -*-
import math
N = int(input())
graph = [{} for _ in range(N)]

for _ in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    graph[u][v] = w
    graph[v][u] = w

d = [-1 for _ in range(N)]
src = 0
d[src] = 0
buf = [src]

while buf:
    src = buf.pop()
    for dst, w in graph[src].items():
        if d[dst] == -1:
            d[dst] = d[src] + w
            buf.append(dst)

for n in d:
    if n % 2:
        print(0)
    else:
        print(1) import math math N = int(input()) N int(input()) int input() input {} for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) {} graph = [{} for _ in range(N)] graph [{} for _ in range(N)] for _ in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    graph[u][v] = w
    graph[v][u] = w _ range(N-1) range N-1 N 1 u, v, w = map(int, input().split()) u map(int, input().split()) map int input().split() ().split () input split v w u -= 1 u 1 v -= 1 v 1 graph[u][v] = w graph[u][v] [u] graph u v w graph[v][u] = w graph[v][u] [v] graph v u w -1 for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) -1 d = [-1 for _ in range(N)] d [-1 for _ in range(N)] src = 0 src 0 d[src] = 0 d[src] d src 0 buf = [src] buf [src] src while buf:
    src = buf.pop()
    for dst, w in graph[src].items():
        if d[dst] == -1:
            d[dst] = d[src] + w
            buf.append(dst) buf src = buf.pop() src buf.pop() buf.pop buf pop for dst, w in graph[src].items():
        if d[dst] == -1:
            d[dst] = d[src] + w
            buf.append(dst) dst w graph[src].items() [src].items [src] graph src items if d[dst] == -1:
            d[dst] = d[src] + w
            buf.append(dst) d[dst] == -1 d[dst] d dst -1 d[dst] = d[src] + w d[dst] d dst d[src] + w d[src] d src w buf.append(dst) buf.append buf append dst for n in d:
    if n % 2:
        print(0)
    else:
        print(1) n d if n % 2:
        print(0)
    else:
        print(1) n % 2 n 2 print(0) print 0 print(1) print 1 w = map(int, input().split()) map(int, input().split()) w d = [-1 for _ in range(N)] [-1 for _ in range(N)] d v -= 1 1 v N = int(input()) int(input()) N u -= 1 1 u u, v, w = map(int, input().split()) map(int, input().split()) u v, w = map(int, input().split()) map(int, input().split()) v src = 0 0 src buf = [src] [src] buf graph = [{} for _ in range(N)] [{} for _ in range(N)] graph src = buf.pop() buf.pop() src
# -*- coding: utf-8 -*-
import math
N = int(input())
graph = [{} for _ in range(N)]

for _ in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    graph[u][v] = w
    graph[v][u] = w

d = [-1 for _ in range(N)]
src = 0
d[src] = 0
buf = [src]

while buf:
    src = buf.pop()
    for dst, w in graph[src].items():
        if d[dst] == -1:
            d[dst] = d[src] + w
            buf.append(dst)

for n in d:
    if n % 2:
        print(0)
    else:
        print(1)