N = int(input())
graph = [[] for  _ in range(N)]
now = 0
for _ in range(N-1):
    x,y,w = map(int,input().split())
    x -= 1
    y -= 1
    graph[x].append((y,w))
    graph[y].append((x,w))
    now = x
    
vis = [0 for _ in range(N)]

even = set()
odd = set()
import sys
sys.setrecursionlimit(10000000)


def dfs(now):
    #print(now)
    for nv in graph[now]:
        if vis[nv[0]]: continue
        if nv[1] % 2 == 0:
            if now in even:
                even.add(nv[0])
            else:
                odd.add(nv[0])
        else:
            if now in even:
                odd.add(nv[0])
            else:
                even.add(nv[0])
        vis[nv[0]] = 1
        dfs(nv[0])
vis[x] = 1
even.add(x)
dfs(x)

for i in range(N):
    if i in even:
        print(1)
    else:
        print(0)
 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)] now = 0 now 0 for _ in range(N-1):
    x,y,w = map(int,input().split())
    x -= 1
    y -= 1
    graph[x].append((y,w))
    graph[y].append((x,w))
    now = x
     _ range(N-1) range N-1 N 1 x,y,w = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y w x -= 1 x 1 y -= 1 y 1 graph[x].append((y,w)) [x].append [x] graph x append (y,w) y w graph[y].append((x,w)) [y].append [y] graph y append (x,w) x w now = x now x 0 for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) 0 vis = [0 for _ in range(N)] vis [0 for _ in range(N)] even = set() even set() set odd = set() odd set() set import sys sys sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 def dfs(now):
    #print(now)
    for nv in graph[now]:
        if vis[nv[0]]: continue
        if nv[1] % 2 == 0:
            if now in even:
                even.add(nv[0])
            else:
                odd.add(nv[0])
        else:
            if now in even:
                odd.add(nv[0])
            else:
                even.add(nv[0])
        vis[nv[0]] = 1
        dfs(nv[0]) dfs for nv in graph[now]:
        if vis[nv[0]]: continue
        if nv[1] % 2 == 0:
            if now in even:
                even.add(nv[0])
            else:
                odd.add(nv[0])
        else:
            if now in even:
                odd.add(nv[0])
            else:
                even.add(nv[0])
        vis[nv[0]] = 1
        dfs(nv[0]) nv graph[now] graph now if vis[nv[0]]: continue
         vis[nv[0]] vis nv[0] nv 0 if nv[1] % 2 == 0:
            if now in even:
                even.add(nv[0])
            else:
                odd.add(nv[0])
        else:
            if now in even:
                odd.add(nv[0])
            else:
                even.add(nv[0])
         nv[1] % 2 == 0 nv[1] % 2 nv[1] nv 1 2 0 if now in even:
                even.add(nv[0])
            else:
                odd.add(nv[0])
         now in even now even even.add(nv[0]) even.add even add nv[0] nv 0 odd.add(nv[0]) odd.add odd add nv[0] nv 0 if now in even:
                odd.add(nv[0])
            else:
                even.add(nv[0])
         now in even now even odd.add(nv[0]) odd.add odd add nv[0] nv 0 even.add(nv[0]) even.add even add nv[0] nv 0 vis[nv[0]] = 1 vis[nv[0]] vis nv[0] nv 0 1 dfs(nv[0]) dfs nv[0] nv 0 now now vis[x] = 1 vis[x] vis x 1 even.add(x) even.add even add x dfs(x) dfs x for i in range(N):
    if i in even:
        print(1)
    else:
        print(0) i range(N) range N if i in even:
        print(1)
    else:
        print(0) i in even i even print(1) print 1 print(0) print 0 vis = [0 for _ in range(N)] [0 for _ in range(N)] vis even = set() set() even graph = [[] for  _ in range(N)] [[] for  _ in range(N)] graph now = 0 0 now N = int(input()) int(input()) N now = x x now x -= 1 1 x odd = set() set() odd def dfs(now):
    #print(now)
    for nv in graph[now]:
        if vis[nv[0]]: continue
        if nv[1] % 2 == 0:
            if now in even:
                even.add(nv[0])
            else:
                odd.add(nv[0])
        else:
            if now in even:
                odd.add(nv[0])
            else:
                even.add(nv[0])
        vis[nv[0]] = 1
        dfs(nv[0]) def dfs(now):
    #print(now)
    for nv in graph[now]:
        if vis[nv[0]]: continue
        if nv[1] % 2 == 0:
            if now in even:
                even.add(nv[0])
            else:
                odd.add(nv[0])
        else:
            if now in even:
                odd.add(nv[0])
            else:
                even.add(nv[0])
        vis[nv[0]] = 1
        dfs(nv[0]) dfs y,w = map(int,input().split()) map(int,input().split()) y x,y,w = map(int,input().split()) map(int,input().split()) x y -= 1 1 y w = map(int,input().split()) map(int,input().split()) w
N = int(input())
graph = [[] for  _ in range(N)]
now = 0
for _ in range(N-1):
    x,y,w = map(int,input().split())
    x -= 1
    y -= 1
    graph[x].append((y,w))
    graph[y].append((x,w))
    now = x
    
vis = [0 for _ in range(N)]

even = set()
odd = set()
import sys
sys.setrecursionlimit(10000000)


def dfs(now):
    #print(now)
    for nv in graph[now]:
        if vis[nv[0]]: continue
        if nv[1] % 2 == 0:
            if now in even:
                even.add(nv[0])
            else:
                odd.add(nv[0])
        else:
            if now in even:
                odd.add(nv[0])
            else:
                even.add(nv[0])
        vis[nv[0]] = 1
        dfs(nv[0])
vis[x] = 1
even.add(x)
dfs(x)

for i in range(N):
    if i in even:
        print(1)
    else:
        print(0)

