1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import java.util.*;
import java.lang.*;
import java.io.*;

class mis {

	public static long sumCol (int[] tab) {
		long result = 0;
		for (int i = 1; i < tab.length; i++) {
			result += tab[i];	
		}

		return result;
	}
	public static void main (String[] args) throws java.lang.Exception	{

		Scanner input = new Scanner(System.in);
		int n = input.nextInt() + 1;
		long m = input.nextLong();
		long d = input.nextLong();
		int[][] tab = new int[n][n];

		for (int i = 1; i < n; i++) {
			for (int j = 1; j < n; j++) {
				tab[i][j] = 0;			
			}		
		}

		for (int i = 0; i < m; i++) {
			int a = input.nextInt();
			int b = input.nextInt();
			tab[a][b] = 1;
			tab[b][a] = 1;
		}

		for (int i = 1; i < n; i++) {
			if (sumCol(tab[i]) < d) {
				for (int j = 1; j < n; j++) {
					tab[i][j] = 0;
				}
				for (int j = 1; j < n; j++) {
					tab[j][i] = 0;				
				}
			}
		}
		
		String indexes = "";
		long result = 0;
		for (int i = 1; i < n; i++) {
			if (sumCol(tab[i]) >= d) {
				result++;
				indexes += i + " ";
			}
		}
		
		if (result > 0) {
			System.out.println(result);
			System.out.println(indexes);
		}
		else System.out.println("NIE");

		
	}
}