#P4323. [JSOI2016] 独特的树叶
[JSOI2016] 独特的树叶
Description
JYY has two trees and : tree has nodes labeled from to ; tree has nodes labeled from to .
JYY knows that tree is obtained from tree by adding one leaf node and then shuffling the node labels. He wants to determine which leaf node in tree is the extra one.
Input Format
The first line contains a positive integer .
The next lines describe tree , each containing two integers that represent an edge of tree .
The next lines describe tree , each containing two integers that represent an edge of tree .
Output Format
Output a single integer: the label in tree of the extra leaf compared to tree . If multiple leaves satisfy the condition, output the smallest label among them.
5
1 2
2 3
1 4
1 5
1 2
2 3
3 4
4 5
3 6
1
Hint
For all testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号