First line contains an interger N which is the number of nodes in the tree.

Next N lines contain an integer each which are values associated with nodes i.e, ith line contains the value associated with node i-1.

Next N-1 lines give the information of edges in the tree. Each line contains two Space separated integers X and Y which says that there is an edge between node X and node Y.

If the following input is given, Can anyone give the code to create binary tree

5

0

0

1

1

1

0 1

0 2

2 3

2 4