#1647 Problem F. Transitive Closure

2 s   128 MB  

Description

Problem Link (pdf)

Sample Input

Sample Output

2
3 2
1 2
2 3
4 4
1 2
2 3
2 4
4 1
3
9

Source

2010 ACM-ICPC Asia Jakarta Regional