Problem P
A Tree and Two Edges
Given a connected simple graph (with at most one edge
between any pair of nodes) with
Input
The first line of input contains two integers
Each of the next
Each of the next
Output
Output
Sample Input 1 | Sample Output 1 |
---|---|
4 6 1 2 1 3 1 4 2 3 2 4 1 2 1 3 1 4 2 3 2 4 3 4 |
3 3 3 3 3 4 |
Sample Input 2 | Sample Output 2 |
---|---|
6 4 1 2 1 3 1 6 2 3 3 4 3 5 4 5 1 2 1 3 1 4 1 6 |
2 2 4 1 |