Given a tree of $n$ vertices rooted at $1$, vertex $i$ has color $A_i$. For each vertex $u$, count the number of distinct colors in the subtree rooted at $u$.
### Input
- The first line contains an integers $n$.
- The second line contains $n$ integers $A_i$.
- The next $n - 1$ lines, each line contains two integers $u, v$, there is an edge between $u$ and $v$.
### Output
- Print $n$ integers, the $i^{th}$ is the answer for vertex $i$.
### Constraints
- $1 \le n \le 10^5$.
- $1 \le A_i \le 10^5$.
- $1 \le u, v \le n$.
### Example
Input:
```
4
1 2 2 2
1 2
2 3
2 4
```
Output:
```
2 1 1 1
```