Soccer Match

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

As a big sports fan, you, the primary leader of the Pigeon Kingdom, are organizing a soccer match! A total of NN players signed up for the match, and you plan to divide them into three groups: Red team, Blue team, and spectators. The number of players in the Red team and the Blue team can be different.

There are MM pairs of friends among the NN participants, where M2KNM \ge 2KN for some given constant K1K \ge 1. The friendship is mutual, which means that if aa is a friend of bb, then bb is a friend of aa, and vice versa. To make the match more exciting, you want to make sure that each player in the Red team has at least K+1K + 1 friends in the Blue team, and each player in the Blue team has at least K+1K + 1 friends in the Red team. Can you find an arrangement satisfying such constraints?

입력

The first line contains one integer TT (1T50,0001\le T\le50\\,000), denoting the number of test cases. For each test case:

The first line contains three integers, NN, MM, and KK (1N,M,K50,0001 \le N, M, K \le 50\\,000 and M2KNM \ge 2KN), denoting the number of players, the number of pairs of friends, and the given constant, respectively.

Then MM lines follow, each containing two integers uu and vv (1u<vN1 \le u < v \le N), denoting that uu and vv are friends.

It is guaranteed that, in each test case, each pair of (u,v)(u, v) appears at most once, and the sum of MM over all test cases does not exceed 50,00050\\,000.

출력

For each test case, output two lines:

The first line begins with one integer R(R>0)R(R > 0), denoting the number of players in the Red team. Then RR space-separated integers follow, each denoting the index of a player in the Red team.

The second line follows the same format. It begins with an integer B(B>0)B(B > 0), denoting the number of players in the Blue team. Then BB space-separated integers follow, each denoting the index of a player in the Blue team.

If there are multiple solutions, you can output any one of them. It can be shown that, under such constraints, a solution always exists.