from sys import setrecursionlimit
setrecursionlimit(10 ** 7)
n = int(input())
uvw = [list(map(int, input().split())) for i in range(n - 1)]
d = [-1 for i in range(n)]
edge = [[] for i in range(n)]
for u, v, w in uvw:
    edge[u - 1].append((v - 1, w))
    edge[v - 1].append((u - 1, w))
def dfs(now, D):
    d[now] = D
    for i, j in edge[now]:
        if d[i] == -1:
            dfs(i, D + j)
dfs(0, 0)
for i in d:
    print(i % 2) from sys import setrecursionlimit setrecursionlimit(10 ** 7) setrecursionlimit 10 ** 7 10 7 n = int(input()) n int(input()) int input() input list(map(int, input().split())) 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) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split uvw = [list(map(int, input().split())) for i in range(n - 1)] uvw [list(map(int, input().split())) for i in range(n - 1)] -1 for i in range(n) for i in range(n) i range(n) range n for i in range(n) -1 d = [-1 for i in range(n)] d [-1 for i in range(n)] [] for i in range(n) for i in range(n) i range(n) range n for i in range(n) [] edge = [[] for i in range(n)] edge [[] for i in range(n)] for u, v, w in uvw:
    edge[u - 1].append((v - 1, w))
    edge[v - 1].append((u - 1, w)) u v w uvw edge[u - 1].append((v - 1, w)) [u - 1].append [u - 1] edge u - 1 u 1 append (v - 1, w) v - 1 v 1 w edge[v - 1].append((u - 1, w)) [v - 1].append [v - 1] edge v - 1 v 1 append (u - 1, w) u - 1 u 1 w def dfs(now, D):
    d[now] = D
    for i, j in edge[now]:
        if d[i] == -1:
            dfs(i, D + j) dfs d[now] = D d[now] d now D for i, j in edge[now]:
        if d[i] == -1:
            dfs(i, D + j) i j edge[now] edge now if d[i] == -1:
            dfs(i, D + j) d[i] == -1 d[i] d i -1 dfs(i, D + j) dfs i D + j D j now now D D dfs(0, 0) dfs 0 0 for i in d:
    print(i % 2) i d print(i % 2) print i % 2 i 2 uvw = [list(map(int, input().split())) for i in range(n - 1)] [list(map(int, input().split())) for i in range(n - 1)] uvw d = [-1 for i in range(n)] [-1 for i in range(n)] d n = int(input()) int(input()) n edge = [[] for i in range(n)] [[] for i in range(n)] edge def dfs(now, D):
    d[now] = D
    for i, j in edge[now]:
        if d[i] == -1:
            dfs(i, D + j) def dfs(now, D):
    d[now] = D
    for i, j in edge[now]:
        if d[i] == -1:
            dfs(i, D + j) dfs
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)
n = int(input())
uvw = [list(map(int, input().split())) for i in range(n - 1)]
d = [-1 for i in range(n)]
edge = [[] for i in range(n)]
for u, v, w in uvw:
    edge[u - 1].append((v - 1, w))
    edge[v - 1].append((u - 1, w))
def dfs(now, D):
    d[now] = D
    for i, j in edge[now]:
        if d[i] == -1:
            dfs(i, D + j)
dfs(0, 0)
for i in d:
    print(i % 2)