Bitset Master
题号:NC201919
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

It’s well known in China that algorithms can pass the problem with easily.
You are given a tree with n vertices and n-1 edges . For each vertex ,there is a set initially.
You need to perform operations. For the i-th operation, you are given an edge p_i and let and be the union of them.
Finally, you need to find the number of sets contains for each vertex .

输入描述:

The first line contains two integers .
Each line in the following lines contains two integers .
The following line contains integers .

输出描述:

Output one line with  integers, the -th of which indicates the number of sets  contains .
示例1

输入

复制
5 6
1 2
1 3
1 4
1 5
4 3 2 1 2 3

输出

复制
5 4 4 4 5