import networkx as nx

N = int(input())
UVW = [list(map(int, input().split())) for _ in range(N - 1)]

G = nx.Graph()

color = [0 for _ in range(N)]

for u, v, w in UVW:
    G.add_edge(u - 1, v - 1, weight=w)

color[0] = -1

pred, dist = nx.dijkstra_predecessor_and_distance(G, 0)

c = [dist[i] for i in range(N)]
ans = [1 if i % 2 == 0 else 0 for i in c]
print(*ans) import networkx as nx networkx N = int(input()) N int(input()) int input() input list(map(int, input().split())) for _ in range(N - 1) for _ in range(N - 1) _ range(N - 1) range N - 1 N 1 for _ in range(N - 1) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split UVW = [list(map(int, input().split())) for _ in range(N - 1)] UVW [list(map(int, input().split())) for _ in range(N - 1)] G = nx.Graph() G nx.Graph() nx.Graph nx Graph 0 for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) 0 color = [0 for _ in range(N)] color [0 for _ in range(N)] for u, v, w in UVW:
    G.add_edge(u - 1, v - 1, weight=w) u v w UVW G.add_edge(u - 1, v - 1, weight=w) G.add_edge G add_edge u - 1 u 1 v - 1 v 1 weight=w weight w color[0] = -1 color[0] color 0 -1 pred, dist = nx.dijkstra_predecessor_and_distance(G, 0) pred nx.dijkstra_predecessor_and_distance(G, 0) nx.dijkstra_predecessor_and_distance nx dijkstra_predecessor_and_distance G 0 dist dist[i] for i in range(N) for i in range(N) i range(N) range N for i in range(N) dist[i] dist i c = [dist[i] for i in range(N)] c [dist[i] for i in range(N)] 1 if i % 2 == 0 else 0 for i in c for i in c i c for i in c 1 if i % 2 == 0 else 0 i % 2 == 0 i % 2 i 2 0 1 0 ans = [1 if i % 2 == 0 else 0 for i in c] ans [1 if i % 2 == 0 else 0 for i in c] print(*ans) print *ans ans dist = nx.dijkstra_predecessor_and_distance(G, 0) nx.dijkstra_predecessor_and_distance(G, 0) dist pred, dist = nx.dijkstra_predecessor_and_distance(G, 0) nx.dijkstra_predecessor_and_distance(G, 0) pred UVW = [list(map(int, input().split())) for _ in range(N - 1)] [list(map(int, input().split())) for _ in range(N - 1)] UVW N = int(input()) int(input()) N c = [dist[i] for i in range(N)] [dist[i] for i in range(N)] c color = [0 for _ in range(N)] [0 for _ in range(N)] color G = nx.Graph() nx.Graph() G ans = [1 if i % 2 == 0 else 0 for i in c] [1 if i % 2 == 0 else 0 for i in c] ans
import networkx as nx

N = int(input())
UVW = [list(map(int, input().split())) for _ in range(N - 1)]

G = nx.Graph()

color = [0 for _ in range(N)]

for u, v, w in UVW:
    G.add_edge(u - 1, v - 1, weight=w)

color[0] = -1

pred, dist = nx.dijkstra_predecessor_and_distance(G, 0)

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