import sys
sys.setrecursionlimit(10**7)
N = int(input())

Graph = [[] for _ in range(N+1)]
dist  = [1000000000000]*(N+1)

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


def func(fromE,now,length):
	dist[now] = length
	for i in range(len(Graph[now])):
		target = Graph[now][i][0]
		lengt  = Graph[now][i][1]

		if target == fromE:
			continue

		func(now,target,dist[now]+lengt)

func(-1,0,0)

for i in range(N):
	if dist[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 [] for _ in range(N+1) for _ in range(N+1) _ range(N+1) range N+1 N 1 for _ in range(N+1) [] Graph = [[] for _ in range(N+1)] Graph [[] for _ in range(N+1)] dist  = [1000000000000]*(N+1) dist [1000000000000]*(N+1) [1000000000000] 1000000000000 N+1 N 1 for i in range(N-1):
	u,v,w = map(int,input().split())
	u-=1
	v-=1
	Graph[u].append((v,w))
	Graph[v].append((u,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 u-=1 u 1 v-=1 v 1 Graph[u].append((v,w)) [u].append [u] Graph u append (v,w) v w Graph[v].append((u,w)) [v].append [v] Graph v append (u,w) u w def func(fromE,now,length):
	dist[now] = length
	for i in range(len(Graph[now])):
		target = Graph[now][i][0]
		lengt  = Graph[now][i][1]

		if target == fromE:
			continue

		func(now,target,dist[now]+lengt) func dist[now] = length dist[now] dist now length for i in range(len(Graph[now])):
		target = Graph[now][i][0]
		lengt  = Graph[now][i][1]

		if target == fromE:
			continue

		func(now,target,dist[now]+lengt) i range(len(Graph[now])) range len(Graph[now]) len Graph[now] Graph now target = Graph[now][i][0] target Graph[now][i][0] [i] [now] Graph now i 0 lengt  = Graph[now][i][1] lengt Graph[now][i][1] [i] [now] Graph now i 1 if target == fromE:
			continue

		 target == fromE target fromE continue func(now,target,dist[now]+lengt) func now target dist[now]+lengt dist[now] dist now lengt fromE fromE now now length length func(-1,0,0) func -1 0 0 for i in range(N):
	if dist[i]%2 == 0:
		print(0)
	else:
		print(1) i range(N) range N if dist[i]%2 == 0:
		print(0)
	else:
		print(1) dist[i]%2 == 0 dist[i]%2 dist[i] dist i 2 0 print(0) print 0 print(1) print 1 def func(fromE,now,length):
	dist[now] = length
	for i in range(len(Graph[now])):
		target = Graph[now][i][0]
		lengt  = Graph[now][i][1]

		if target == fromE:
			continue

		func(now,target,dist[now]+lengt) def func(fromE,now,length):
	dist[now] = length
	for i in range(len(Graph[now])):
		target = Graph[now][i][0]
		lengt  = Graph[now][i][1]

		if target == fromE:
			continue

		func(now,target,dist[now]+lengt) func v,w = map(int,input().split()) map(int,input().split()) v Graph = [[] for _ in range(N+1)] [[] for _ in range(N+1)] Graph dist  = [1000000000000]*(N+1) [1000000000000]*(N+1) dist u-=1 1 u N = int(input()) int(input()) N v-=1 1 v u,v,w = map(int,input().split()) map(int,input().split()) u w = map(int,input().split()) map(int,input().split()) w
import sys
sys.setrecursionlimit(10**7)
N = int(input())

Graph = [[] for _ in range(N+1)]
dist  = [1000000000000]*(N+1)

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


def func(fromE,now,length):
	dist[now] = length
	for i in range(len(Graph[now])):
		target = Graph[now][i][0]
		lengt  = Graph[now][i][1]

		if target == fromE:
			continue

		func(now,target,dist[now]+lengt)

func(-1,0,0)

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