Computer Science, asked by marketer01online, 7 hours ago

Problem Statement
In a normal tree, the lowest common ancestor (or LCA for short) of two vertices u and vis defined as the lowest vertex that is ancestor of both the vertices.
Given a tree of N vertices, you need to answer in the form "suv" which means if the root of the tree is at r then what is LCA of u and v.
Input:
The first line contains a single integer N. Each line in the next N - 1 lines contains a pair of integers u and v representing an edge between these two vertices.
The next line contains a single integer which is the number of the queries. Each line in the next Q lines contains three integers r, u, v representing a query.
Output:
For each query, write out the answer on a single line.
Example:
Input:
4
12
23
14
2
142
242
programing question

Answers

Answered by athivishnu1331
0

Answer:

sorry I don't know the answer.

Similar questions