#P8235. [AGM 2022 资格赛] 括号
[AGM 2022 资格赛] 括号
Problem Description
You are given a tree with nodes. Node is filled with a left parenthesis. You need to fill each of the remaining nodes with ( or ), so that the number of valid parenthesis paths on the tree is maximized. It is guaranteed that the answer is unique.
Input Format
The first line contains an integer .
The next lines each contain two positive integers , indicating that there is an edge between and .
Output Format
Output a parenthesis string of length in one line.
3
1 2
1 3
())
Hint
Constraints
For of the testdata, it is guaranteed that .
Notes
Translated from AGM 2022 Qualification Round G Parenthesis。
Translated by ChatGPT 5