Problem: You are given a tree consisting of vertices. A number is written on each vertex; the number on vertex is equal to .
Let's denote the function as the greatest common divisor of the numbers written on the vertices belonging to the simple path from vertex to vertex (including these two vertices).
For every integer from to you have to count the number of pairs such that is equal to this number.
Input Format: The first line contains one integer — the number of vertices .
The second line contains integers , , ..., — the numbers written on vertices.
Then lines follow, each containing two integers and denoting an edge connecting vertex with vertex . It is guaranteed that these edges form a tree.
Output Format: For every integer from to do the following: if there is no pair such that and , don't output anything. Otherwise output two integers: and the number of aforementioned pairs. You have to consider the values of in ascending order.
See the examples for better understanding.