You are given a tree consisting of n nodes, rooted at node 1. For each node i from 1...n, value val[i] is given. (val[i] is 0 or 1)
You need to answer q queries of 2 types:
flip x – flip all the values in subtree of node x.
val x – print current value of node x. (val[x])
(Note: subtree of any node, also includes the node itself)
(flip value of x -> perform val[x] = !val[x])
INPUT:
OUTPUT: