## Editorial for Quay bánh xe

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Lưu ý: Các code mẫu dưới đây chỉ mang tính tham khảo và có thể không AC được bài tập này

#### Code mẫu của flashmt

var n,i,a,b:integer;
re,c,f:byte;
begin
re:=0;
for i:=1 to n-1 do
begin
if c=1 then inc(re);
end;
write(re mod 2);
end.


#### Code mẫu của happyboy99x

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define sz(a) int((a).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(), _e = (c).end(); it != _e; ++it)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define rep(i,n) for(int i = 0, _n = (n); i < _n; ++i)
#define repd(i,n) for(int i = (n)-1; i >= 0; --i )
#define fo(i,a,b) for(int i = (a), _b = (b); i <= _b; ++i)
#define fod(i,a,b) for(int i = (a), _b = (b); i >= _b; --i)

#define INF 1000000000
#define N

int main() {
int n, k, res = 0; scanf( "%d", &n );
rep(i,n-1) {scanf("%*d%*d%d",&k); res ^= k;}
printf( "%d\n", res );
return 0;
}


program rotation;
uses    math;
var     f:array[1..1000] of longint;
t,i,res,a,b,c:longint;
begin
for i:=1 to t-1 do
begin
f[a]:=c;
end;
for i:=1 to t-1 do
res:=(res+f[i]) mod 2;
write(res);
end.


#### Code mẫu của RR

var
n,i,a,c,sum:longint;
begin
for i:=2 to n do
begin
inc(sum,c);
end;
writeln(sum and 1);
end.


#### Code mẫu của hieult

#include <stdio.h>
main()
{
int n,m=0,S[1001],D[1001],C[1001];
scanf("%d",&n);
for(int i=1;i<n;i++)
scanf("%d %d %d",&S[i],&D[i],&C[i]);
for(int i=1;i<n;i++)
for(int j=1;j<n;j++)
{
if(S[j]==i)
{
if(C[j]==1)
m++;
break;
}
}
if(m%2==0)
printf("0");
else
printf("1");
}


#### Code mẫu của ll931110

Program ROTATION;
Const
input  = '';
output = '';
Var
n,num: integer;

Procedure init;
Var
fi: text;
i,a,b,c: integer;
Begin
Assign(fi, input);
Reset(fi);

num:= 0;

For i:= 1 to n - 1 do
Begin
If c = 1 then inc(num);
End;

Close(fi);
End;

Procedure solve;
Var
fo: text;
Begin
Assign(fo, output);
Rewrite(fo);

If odd(num) then writeln(fo, 1) else writeln(fo, 0);
Close(fo);
End;

Begin
init;
solve;
End.


#### Code mẫu của khuc_tuan

n = input()
F = [1 for i in range(n+1)]
for i in range(n-1):
[u,v,c] = [int(s) for s in raw_input().split()]
if c==0:
F[v] = 0
else:
F[v] = 1
for i in range(2,n+1):
F[i] = F[i] ^ F[i-1]
print 1 - F[n]