CF601D Acyclic Organic Compounds

Description

You are given a tree $ T $ with $ n $ vertices (numbered $ 1 $ through $ n $ ) and a letter in each vertex. The tree is rooted at vertex $ 1 $ . Let's look at the subtree $ T_{v} $ of some vertex $ v $ . It is possible to read a string along each simple path starting at $ v $ and ending at some vertex in $ T_{v} $ (possibly $ v $ itself). Let's denote the number of distinct strings which can be read this way as ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/a0c9096effba09473c4b51e3186b592318344485.png). Also, there's a number $ c_{v} $ assigned to each vertex $ v $ . We are interested in vertices with the maximum value of ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/c561564d7b2aed4877e755dc8d366f0ff87cf302.png). You should compute two statistics: the maximum value of ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/c561564d7b2aed4877e755dc8d366f0ff87cf302.png) and the number of vertices $ v $ with the maximum ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/c561564d7b2aed4877e755dc8d366f0ff87cf302.png).

Input Format

N/A

Output Format

N/A

Explanation/Hint

In the first sample, the tree looks like this: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/9244e4a8ade3af9b76853a18eae8ae654a6d5be1.png)The sets of strings that can be read from individual vertices are: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/b0a25806e20ff995abfb34a167834abd113ae6f1.png)Finally, the values of ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/c561564d7b2aed4877e755dc8d366f0ff87cf302.png) are: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/6c3fc4aa4c72ec4c2646ac39d7110bd6544e120f.png)In the second sample, the values of ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/4c35255ca2e85f9a2c304b6b5d98f8aa96f62b0c.png) are $ (5,4,2,1,1,1) $ . The distinct strings read in $ T_{2} $ are ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/6427dc79a89c97e7e81a3e52fb54938acda3e0b8.png); note that ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF601D/ff39f896bb407bf8e8d94b0a5b47a67e60c595d8.png) can be read down to vertices $ 3 $ or $ 4 $ .