# https://atcoder.jp/contests/abc126/tasks/abc126_d

# ｄfsでやっていき、最初の点を黒か白かで固定する。偶数ならどんどん加えていく。
n = int(input())
tree = [[] for _ in range(n + 1)]
for _ in range(n - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    tree[u].append((v, w))
    tree[v].append((u, w))


def dfs(tree, n):
    visited = [False] * n
    dis = [0] * n
    even = set([0])
    stack = [0]
    while stack:
        v = stack.pop()
        cur_dis = dis[v]
        for next_v, d in tree[v]:
            if not visited[next_v]:
                visited[next_v] = True
                stack.append(next_v)
                dis[next_v] = cur_dis + d
                if (cur_dis + d) % 2 == 0:
                    even.add(next_v)
    return even

even = dfs(tree, n)
for i in range(n):
    if i in even:
        print(0)
    else:
        print(1) n = int(input()) n int(input()) int input() input [] for _ in range(n + 1) for _ in range(n + 1) _ range(n + 1) range n + 1 n 1 for _ in range(n + 1) [] tree = [[] for _ in range(n + 1)] tree [[] for _ in range(n + 1)] for _ in range(n - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    tree[u].append((v, w))
    tree[v].append((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 tree[u].append((v, w)) [u].append [u] tree u append (v, w) v w tree[v].append((u, w)) [v].append [v] tree v append (u, w) u w def dfs(tree, n):
    visited = [False] * n
    dis = [0] * n
    even = set([0])
    stack = [0]
    while stack:
        v = stack.pop()
        cur_dis = dis[v]
        for next_v, d in tree[v]:
            if not visited[next_v]:
                visited[next_v] = True
                stack.append(next_v)
                dis[next_v] = cur_dis + d
                if (cur_dis + d) % 2 == 0:
                    even.add(next_v)
    return even dfs visited = [False] * n visited [False] * n [False] False n dis = [0] * n dis [0] * n [0] 0 n even = set([0]) even set([0]) set [0] 0 stack = [0] stack [0] 0 while stack:
        v = stack.pop()
        cur_dis = dis[v]
        for next_v, d in tree[v]:
            if not visited[next_v]:
                visited[next_v] = True
                stack.append(next_v)
                dis[next_v] = cur_dis + d
                if (cur_dis + d) % 2 == 0:
                    even.add(next_v)
     stack v = stack.pop() v stack.pop() stack.pop stack pop cur_dis = dis[v] cur_dis dis[v] dis v for next_v, d in tree[v]:
            if not visited[next_v]:
                visited[next_v] = True
                stack.append(next_v)
                dis[next_v] = cur_dis + d
                if (cur_dis + d) % 2 == 0:
                    even.add(next_v)
     next_v d tree[v] tree v if not visited[next_v]:
                visited[next_v] = True
                stack.append(next_v)
                dis[next_v] = cur_dis + d
                if (cur_dis + d) % 2 == 0:
                    even.add(next_v)
     not visited[next_v] visited[next_v] visited next_v visited[next_v] = True visited[next_v] visited next_v True stack.append(next_v) stack.append stack append next_v dis[next_v] = cur_dis + d dis[next_v] dis next_v cur_dis + d cur_dis d if (cur_dis + d) % 2 == 0:
                    even.add(next_v)
     (cur_dis + d) % 2 == 0 (cur_dis + d) % 2 cur_dis + d cur_dis d 2 0 even.add(next_v) even.add even add next_v return even even tree tree n n even = dfs(tree, n) even dfs(tree, n) dfs tree n for i in range(n):
    if i in even:
        print(0)
    else:
        print(1) i range(n) range n if i in even:
        print(0)
    else:
        print(1) i in even i even print(0) print 0 print(1) print 1 tree = [[] for _ in range(n + 1)] [[] for _ in range(n + 1)] tree u, v, w = map(int, input().split()) map(int, input().split()) u v -= 1 1 v even = dfs(tree, n) dfs(tree, n) even def dfs(tree, n):
    visited = [False] * n
    dis = [0] * n
    even = set([0])
    stack = [0]
    while stack:
        v = stack.pop()
        cur_dis = dis[v]
        for next_v, d in tree[v]:
            if not visited[next_v]:
                visited[next_v] = True
                stack.append(next_v)
                dis[next_v] = cur_dis + d
                if (cur_dis + d) % 2 == 0:
                    even.add(next_v)
    return even def dfs(tree, n):
    visited = [False] * n
    dis = [0] * n
    even = set([0])
    stack = [0]
    while stack:
        v = stack.pop()
        cur_dis = dis[v]
        for next_v, d in tree[v]:
            if not visited[next_v]:
                visited[next_v] = True
                stack.append(next_v)
                dis[next_v] = cur_dis + d
                if (cur_dis + d) % 2 == 0:
                    even.add(next_v)
    return even dfs n = int(input()) int(input()) n u -= 1 1 u v, w = map(int, input().split()) map(int, input().split()) v w = map(int, input().split()) map(int, input().split()) w
# https://atcoder.jp/contests/abc126/tasks/abc126_d

# ｄfsでやっていき、最初の点を黒か白かで固定する。偶数ならどんどん加えていく。
n = int(input())
tree = [[] for _ in range(n + 1)]
for _ in range(n - 1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    tree[u].append((v, w))
    tree[v].append((u, w))


def dfs(tree, n):
    visited = [False] * n
    dis = [0] * n
    even = set([0])
    stack = [0]
    while stack:
        v = stack.pop()
        cur_dis = dis[v]
        for next_v, d in tree[v]:
            if not visited[next_v]:
                visited[next_v] = True
                stack.append(next_v)
                dis[next_v] = cur_dis + d
                if (cur_dis + d) % 2 == 0:
                    even.add(next_v)
    return even

even = dfs(tree, n)
for i in range(n):
    if i in even:
        print(0)
    else:
        print(1)