# Description

JM is a good friend of DY.To thank JM for his concern over the years, DY decided to invite him to a nutritious fruit meal.
DY has a tree with n nodes, node 1 is the root.There are many fruits growing at each node of the tree, among which there is ai fruit at node i and each fruit weighs bi.
The fruit is delicious, but the tree is very fragile! Once the total weight of the fruit on the child nodes of a node is too big, the branches can't stand the pressure and break! So you need to keep any node i:

ai<=∑c∈Child(i)ac∗bc

(The data guarantees that the initial situation meets this condition).
JM said,'Thank you for the fruits, but I don't have any internal fluctuations, and I even want to play games. We take turns: select a node, pick several fruits, you can't leave them. No operator can lose.
It doesn't make sense, says DY. We're all smart enough that once the game decides who's first, the results are sure.
However, you don't know the result of the game when you eat melon in the front row, so you have to write a program to know who will win.

# Solution

Obviously, you can make a difference between how many times you go and how many times you add to your father, that is, you can move so much to your father.
Apparently b=0 had no effect on the father, disconnected,
All that's left is a ladder problem. Straight singular or odd layers.

# Code

```#include <cstdio>
#include <algorithm>
#include <map>
#define fo(i,a,b) for(int i=a;i<=b;++i)
#define fod(i,a,b) for(int i=a;i>=b;--i)
#define efo(i,q) for(int i=A[q];i;i=B[i])
#define min(q,w) ((q)>(w)?(w):(q))
#define max(q,w) ((q)<(w)?(w):(q))
using namespace std;
const int N=50500;
{
char ch=' ';int q=0,w=1;
for(;(ch!='-')&&((ch<'0')||(ch>'9'));ch=getchar());
if(ch=='-')w=-1,ch=getchar();
for(;ch>='0' && ch<='9';ch=getchar())q=q*10+ch-48;n=q*w;return n;
}
int m,n,ans;
int a[N],b[N];
int B[2*N],A[N],B0;
{
B[++B0]=A[q];A[q]=B0,B[B0]=w;
B[++B0]=A[w];A[w]=B0,B[B0]=q;
}
void dfs(int q,int c,int fa)
{
efo(i,q)if(B[i]!=fa)a[q]-=a[B[i]]*b[B[i]];
if(!b[q])c=1;
if(c&1)ans=ans^a[q];
efo(i,q)if(B[i]!=fa)dfs(B[i],c+1,q);
}
int main()
{
freopen("meal.in","r",stdin);
freopen("meal.out","w",stdout);
int q,w,_;
{