CF1010D Mars rover
Description
Natasha travels around Mars in the Mars rover. But suddenly it broke down, namely — the logical scheme inside it. The scheme is an undirected tree (connected acyclic graph) with a root in the vertex $ 1 $ , in which every leaf (excluding root) is an input, and all other vertices are logical elements, including the root, which is output. One bit is fed to each input. One bit is returned at the output.
There are four types of logical elements: [AND](https://en.wikipedia.org/wiki/Logical_conjunction) ( $ 2 $ inputs), [OR](https://en.wikipedia.org/wiki/Logical_disjunction) ( $ 2 $ inputs), [XOR](https://en.wikipedia.org/wiki/Exclusive_or) ( $ 2 $ inputs), [NOT](https://en.wikipedia.org/wiki/Negation) ( $ 1 $ input). Logical elements take values from their direct descendants (inputs) and return the result of the function they perform. Natasha knows the logical scheme of the Mars rover, as well as the fact that only one input is broken. In order to fix the Mars rover, she needs to change the value on this input.
For each input, determine what the output will be if Natasha changes this input.
Input Format
N/A
Output Format
N/A
Explanation/Hint
The original scheme from the example (before the input is changed):

Green indicates bits '1', yellow indicates bits '0'.
If Natasha changes the input bit $ 2 $ to $ 0 $ , then the output will be $ 1 $ .
If Natasha changes the input bit $ 3 $ to $ 0 $ , then the output will be $ 0 $ .
If Natasha changes the input bit $ 6 $ to $ 1 $ , then the output will be $ 1 $ .
If Natasha changes the input bit $ 8 $ to $ 0 $ , then the output will be $ 1 $ .
If Natasha changes the input bit $ 9 $ to $ 0 $ , then the output will be $ 0 $ .