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
#include <iostream>
#include <vector>

using namespace std;

int main(){ 
    int m, n, d;
    cin >> n;
    cin >> m;
    cin >> d;
    
    vector<int> tab[n];
    
    int x = 0;
    int y = 0;
    
    for(int i = 0; i < m; i++){
        cin >> x;
        cin >> y;
        tab[x-1].push_back(y-1);
        tab[y-1].push_back(x-1);
    }
    
    
    
    bool tabl[n];
    int tabl2[n];
    
    for(int i = 0; i < n; i++){
        tabl[i] = false;
        tabl2[i] = tab[i].size();
    }
    
    
    
    for(int i = 0; i < n; i++){
        if(tabl2[i] >= d)
            tabl[i] = true;
        else
            for(int j = 0; j < tab[i].size(); j++){
                tabl2[tab[i][j]] --; 
                if(tabl2[tab[i][j]] < d)
                    tabl[tab[i][j]] = false;
            }
    }
    
    bool czy = false;
    
    for(int i = 0; i < n; i++){
        if(tabl[i]){
            cout << i+1 << endl;
            czy = true;
        }
    }    
    
    if(!czy)
        cout << "NIE" << endl;
    
    
    
    return 0;
}