import queue
n=int(input())
e=[[] for _ in range(n)]
INF=10**18
d=[INF]*n
for _ in range(n-1):
  v,u,w=map(int,input().split())
  e[v-1]+=[(u-1,w)]
  e[u-1]+=[(v-1,w)]
q=queue.Queue()
q.put(0)
d[0]=0
while not q.empty():
  now=q.get()
  for to,dis in e[now]:
    if d[to]==INF:
      d[to]=d[now]+dis
      q.put(to)
for i in d:
  print(i%2) import queue queue 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) [] e=[[] for _ in range(n)] e [[] for _ in range(n)] INF=10**18 INF 10**18 10 18 d=[INF]*n d [INF]*n [INF] INF n for _ in range(n-1):
  v,u,w=map(int,input().split())
  e[v-1]+=[(u-1,w)]
  e[u-1]+=[(v-1,w)] _ range(n-1) range n-1 n 1 v,u,w=map(int,input().split()) v map(int,input().split()) map int input().split() ().split () input split u w e[v-1]+=[(u-1,w)] e[v-1] e v-1 v 1 [(u-1,w)] (u-1,w) u-1 u 1 w e[u-1]+=[(v-1,w)] e[u-1] e u-1 u 1 [(v-1,w)] (v-1,w) v-1 v 1 w q=queue.Queue() q queue.Queue() queue.Queue queue Queue q.put(0) q.put q put 0 d[0]=0 d[0] d 0 0 while not q.empty():
  now=q.get()
  for to,dis in e[now]:
    if d[to]==INF:
      d[to]=d[now]+dis
      q.put(to) not q.empty() q.empty() q.empty q empty now=q.get() now q.get() q.get q get for to,dis in e[now]:
    if d[to]==INF:
      d[to]=d[now]+dis
      q.put(to) to dis e[now] e now if d[to]==INF:
      d[to]=d[now]+dis
      q.put(to) d[to]==INF d[to] d to INF d[to]=d[now]+dis d[to] d to d[now]+dis d[now] d now dis q.put(to) q.put q put to for i in d:
  print(i%2) i d print(i%2) print i%2 i 2 now=q.get() q.get() now v,u,w=map(int,input().split()) map(int,input().split()) v n=int(input()) int(input()) n e=[[] for _ in range(n)] [[] for _ in range(n)] e d=[INF]*n [INF]*n d INF=10**18 10**18 INF w=map(int,input().split()) map(int,input().split()) w q=queue.Queue() queue.Queue() q u,w=map(int,input().split()) map(int,input().split()) u
import queue
n=int(input())
e=[[] for _ in range(n)]
INF=10**18
d=[INF]*n
for _ in range(n-1):
  v,u,w=map(int,input().split())
  e[v-1]+=[(u-1,w)]
  e[u-1]+=[(v-1,w)]
q=queue.Queue()
q.put(0)
d[0]=0
while not q.empty():
  now=q.get()
  for to,dis in e[now]:
    if d[to]==INF:
      d[to]=d[now]+dis
      q.put(to)
for i in d:
  print(i%2)