#P1909E. Multiple Lamps

    ID: 10312 Type: RemoteJudge 3000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 9 Uploaded By: Tags>bitmasksbrute forceconstructive algorithmsmathnumber theory*2400

Multiple Lamps

Description

You have nn lamps, numbered from 11 to nn. Initially, all the lamps are turned off.

You also have nn buttons. The ii-th button toggles all the lamps whose index is a multiple of ii. When a lamp is toggled, if it was off it turns on, and if it was on it turns off.

You have to press some buttons according to the following rules.

  • You have to press at least one button.
  • You cannot press the same button multiple times.
  • You are given mm pairs (ui,vi)(u_i, v_i). If you press the button uiu_i, you also have to press the button viv_i (at any moment, not necessarily after pressing the button uiu_i). Note that, if you press the button viv_i, you don't need to press the button uiu_i.

You don't want to waste too much electricity. Find a way to press buttons such that at the end at most n/5\lfloor n/5 \rfloor lamps are on, or print 1-1 if it is impossible.

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1041 \le t \le 10^4). The description of the test cases follows.

The first line of each test case contains two integers nn and mm (1n21051 \leq n \leq 2 \cdot 10^5, 0m21050 \leq m \leq 2 \cdot 10^5) — the number of lamps and the number of pairs, respectively.

Each of the next mm lines contains two integers uiu_i, viv_i (1ui,vin1 \leq u_i, v_i \leq n, uiviu_i \neq v_i). If you press the button uiu_i, you also have to press the button viv_i. It is guaranteed that the pairs (ui,vi)(u_i, v_i) are distinct.

It is guaranteed that the sum of nn and the sum of mm over all test cases do not exceed 21052 \cdot 10^5.

For each test case:

  • If there is no choice of buttons that makes at most n/5\lfloor n/5 \rfloor lamps on at the end, output a single line containing 1-1.
  • Otherwise, output two lines. The first line should contain an integer kk (1kn1 \le k \le n) — the number of pressed buttons. The second line should contain kk integers b1,b2,,bkb_1, b_2, \dots, b_k (1bin1 \le b_i \le n) — the indices of the pressed buttons (in any order). The bib_i must be distinct, and at the end at most n/5\lfloor n/5 \rfloor lamps must be turned on.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1041 \le t \le 10^4). The description of the test cases follows.

The first line of each test case contains two integers nn and mm (1n21051 \leq n \leq 2 \cdot 10^5, 0m21050 \leq m \leq 2 \cdot 10^5) — the number of lamps and the number of pairs, respectively.

Each of the next mm lines contains two integers uiu_i, viv_i (1ui,vin1 \leq u_i, v_i \leq n, uiviu_i \neq v_i). If you press the button uiu_i, you also have to press the button viv_i. It is guaranteed that the pairs (ui,vi)(u_i, v_i) are distinct.

It is guaranteed that the sum of nn and the sum of mm over all test cases do not exceed 21052 \cdot 10^5.

Output

For each test case:

  • If there is no choice of buttons that makes at most n/5\lfloor n/5 \rfloor lamps on at the end, output a single line containing 1-1.
  • Otherwise, output two lines. The first line should contain an integer kk (1kn1 \le k \le n) — the number of pressed buttons. The second line should contain kk integers b1,b2,,bkb_1, b_2, \dots, b_k (1bin1 \le b_i \le n) — the indices of the pressed buttons (in any order). The bib_i must be distinct, and at the end at most n/5\lfloor n/5 \rfloor lamps must be turned on.

Sample Input 1

4
4 0
5 2
4 1
5 1
15 9
7 8
8 9
9 10
10 9
11 1
12 2
13 3
14 4
15 5
5 4
1 2
2 3
3 4
4 5

Sample Output 1

-1
4
3 5 1 2
3
8 9 10
1
5

Note

In the first test case, you need to turn at most 4/5\lfloor 4/5 \rfloor lamps on, which means that no lamp can be turned on. You can show that no choice of at least one button turns 00 lamps on.

In the second test case, you can press buttons 33, 55, 11, 22.

  • Initially, all the lamps are off;
  • after pressing button 33, the lamps whose index is a multiple of 33 (i.e., 33) are toggled, so lamp 33 is turned on;
  • after pressing button 55, the lamps whose index is a multiple of 55 (i.e., 55) are toggled, so lamps 33, 55 are turned on;
  • after pressing button 11, the lamps whose index is a multiple of 11 (i.e., 11, 22, 33, 44, 55) are toggled, so lamps 11, 22, 44 are turned on;
  • after pressing button 22, the lamps whose index is a multiple of 22 (i.e., 22, 44) are toggled, so lamp 11 is turned on.

This is valid because

  • you pressed at least one button;
  • you pressed all the buttons at most once;
  • you pressed button u2=5u_2 = 5, which means that you had to also press button v2=1v_2 = 1: in fact, button 11 has been pressed;
  • at the end, only lamp 11 is on.

In the third test case, pressing the buttons 88, 99, 1010 turns only the lamps 88, 99, 1010 on.