You are given a rooted tree withnodes, labeled through , rooted at node . Each node in the tree can be in one of two colors, black or white, at any point in time. Initially, all nodes are colored black. Over this tree, you need to perform queries of the following types:
- — report the number of paths in the tree that passes through the edge connecting the nodes and , and has both its endpoints colored in black.
- — flip the color of all the nodes in the subtree of node , i.e., of all nodes that are in the subtree of node , color those nodes white which are currently black, and color those nodes black which are currently white.