#agc029f. [agc029_f]Construction of a tree

[agc029_f]Construction of a tree

给定 n1n-1 个点集(全集为 {1,2,,n}\{1,2,\ldots,n\}),从每个集合内选两个点连边,使得最后形成一棵树。输出方案。

n1n-1 条边按顺序对应这 n1n-1 个集合输出。

n105n \leq 10^5S2×105\sum |S| \leq 2 \times 10^5