import sys
sys.setrecursionlimit(10**7)


n = int(input())
col = [0]*n
next = [[] for i in range(n)]
d = [float('INF')]*n
d[0]=0

def dfs(now,parent):
    for next1,w1 in next[now]:
        if next1 == parent:
            continue
        elif d[next1]==float('INF'):
            d[next1]=d[now]+w1
            dfs(next1,now)

for i in range(n-1):
    u , v , w = map(int, input().split())
    next[u-1].append((v-1,w))
    next[v-1].append((u-1,w))

dfs(0,-1)

for i in range(n):
    if d[i]%2==0:
        print('0')
    else:
        print('1')
 import sys sys sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 n = int(input()) n int(input()) int input() input col = [0]*n col [0]*n [0] 0 n [] for i in range(n) for i in range(n) i range(n) range n for i in range(n) [] next = [[] for i in range(n)] next [[] for i in range(n)] d = [float('INF')]*n d [float('INF')]*n [float('INF')] float('INF') float 'INF' n d[0]=0 d[0] d 0 0 def dfs(now,parent):
    for next1,w1 in next[now]:
        if next1 == parent:
            continue
        elif d[next1]==float('INF'):
            d[next1]=d[now]+w1
            dfs(next1,now) dfs for next1,w1 in next[now]:
        if next1 == parent:
            continue
        elif d[next1]==float('INF'):
            d[next1]=d[now]+w1
            dfs(next1,now) next1 w1 next[now] next now if next1 == parent:
            continue
        elif d[next1]==float('INF'):
            d[next1]=d[now]+w1
            dfs(next1,now) next1 == parent next1 parent continue elif d[next1]==float('INF'):
            d[next1]=d[now]+w1
            dfs(next1,now) d[next1]==float('INF') d[next1] d next1 float('INF') float 'INF' d[next1]=d[now]+w1 d[next1] d next1 d[now]+w1 d[now] d now w1 dfs(next1,now) dfs next1 now now now parent parent for i in range(n-1):
    u , v , w = map(int, input().split())
    next[u-1].append((v-1,w))
    next[v-1].append((u-1,w)) i 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 next[u-1].append((v-1,w)) [u-1].append [u-1] next u-1 u 1 append (v-1,w) v-1 v 1 w next[v-1].append((u-1,w)) [v-1].append [v-1] next v-1 v 1 append (u-1,w) u-1 u 1 w dfs(0,-1) dfs 0 -1 for i in range(n):
    if d[i]%2==0:
        print('0')
    else:
        print('1') i range(n) range n if d[i]%2==0:
        print('0')
    else:
        print('1') d[i]%2==0 d[i]%2 d[i] d i 2 0 print('0') print '0' print('1') print '1' w = map(int, input().split()) map(int, input().split()) w def dfs(now,parent):
    for next1,w1 in next[now]:
        if next1 == parent:
            continue
        elif d[next1]==float('INF'):
            d[next1]=d[now]+w1
            dfs(next1,now) def dfs(now,parent):
    for next1,w1 in next[now]:
        if next1 == parent:
            continue
        elif d[next1]==float('INF'):
            d[next1]=d[now]+w1
            dfs(next1,now) dfs next = [[] for i in range(n)] [[] for i in range(n)] next n = int(input()) int(input()) n col = [0]*n [0]*n col d = [float('INF')]*n [float('INF')]*n d u , v , w = map(int, input().split()) map(int, input().split()) u v , w = map(int, input().split()) map(int, input().split()) v
import sys
sys.setrecursionlimit(10**7)


n = int(input())
col = [0]*n
next = [[] for i in range(n)]
d = [float('INF')]*n
d[0]=0

def dfs(now,parent):
    for next1,w1 in next[now]:
        if next1 == parent:
            continue
        elif d[next1]==float('INF'):
            d[next1]=d[now]+w1
            dfs(next1,now)

for i in range(n-1):
    u , v , w = map(int, input().split())
    next[u-1].append((v-1,w))
    next[v-1].append((u-1,w))

dfs(0,-1)

for i in range(n):
    if d[i]%2==0:
        print('0')
    else:
        print('1')

