You are given a tree with vertices, numbered through . Edge connects vertices and . Each vertex is assigned a color .
You are asked to process queries. In each query, four integers are given.
For each query, determine the maximum integer () such that the following condition holds:
- For every , the number of vertices of color on the path from to is equal to the number of vertices of color on the path from to .