Farmer John is planning to build farms that will be connected by n - 1 roads, forming a tree (i.e., all farms are reachable from each-other, and there are no cycles). Each farm contains a cow with an integer type T_i between and inclusive.
Farmer John's friends often come to visit him. During a visit with friend , Farmer John will walk with his friend along the unique path of roads from farm A_i to farm B_i (it may be the case that A_i = B_i). Additionally, they can try some milk from any cow along the path they walk. Since most of Farmer John's friends are also farmers, they have very strong preferences regarding milk. Each of his friends will only drink milk from a certain type of cow. Any of Farmer John's friends will only be happy if they can drink their preferred type of milk during their visit.
Please determine whether each friend will be happy after visiting.
The first line contains two integers (1 \le n \le 10^5) and (1 \le m \le 10^5). The second line contains integers T_1, T_2, \ldots, T_n. The type of the cow in the -th farm is denoted by T_i.
The next n - 1 lines each contain two distinct integers and (1 \le x, y \le n), indicating that there is an edge between farms and .
The next lines contain integers A_i, B_i and C_i. A_i and B_i represent the endpoints of the path walked during friend 's visit, while C_i (1 \le C_i \le n) indicates the type of cow whose milk the friend enjoys drinking.
Print a binary string of length . The -th character of the string should be '' if the -th friend will be happy, or '' otherwise.
Example 1
Example 2
In this example, the path from and involves farms , and . All of these contain cows of type , so the first friend will be satisfied while the second one will not.