#include <bits/stdc++.h>
#define pi 3.14159265359
using namespace std;
int main() {
int N,M,K;
cin >> N >> M >> K;
vector< vector<int> > G(N,vector<int>(N,0));
for(int i =0; i < M; i++) {
int a,b;
cin >> a >> b;
G[--a][--b]++;
G[b][a]++;}
vector<int> part(N,-1);
map<int,int> m;
for(int i =0; i < N; i++) if(part[i] == -1) {
part[i] =i;
m[i] =0;
for(int j =i+1; j < N; j++) if(G[i][j] == 0) {
if(part[j] != -1) {cout << "-1\n"; return 0;}
part[j] =i;}
}
else if(G[part[i]] != G[i]) {cout << "-1\n"; return 0;}
int a =0;
for(auto it =m.begin(); it != m.end(); it++) it->second =a++;
if(m.size() > K) {cout << "-1\n"; return 0;}
vector<int> ans(N);
for(int i =0; i < N; i++) cout << m[part[i]]+1 << ((i == N-1)?"\n":" ");
return 0;}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgcGkgMy4xNDE1OTI2NTM1OQp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgTixNLEs7CgljaW4gPj4gTiA+PiBNID4+IEs7Cgl2ZWN0b3I8IHZlY3RvcjxpbnQ+ID4gRyhOLHZlY3RvcjxpbnQ+KE4sMCkpOwoJZm9yKGludCBpID0wOyBpIDwgTTsgaSsrKSB7CgkJaW50IGEsYjsKCQljaW4gPj4gYSA+PiBiOwoJCUdbLS1hXVstLWJdKys7CgkJR1tiXVthXSsrO30KCXZlY3RvcjxpbnQ+IHBhcnQoTiwtMSk7CgltYXA8aW50LGludD4gbTsKCWZvcihpbnQgaSA9MDsgaSA8IE47IGkrKykgaWYocGFydFtpXSA9PSAtMSkgewoJCXBhcnRbaV0gPWk7CgkJbVtpXSA9MDsKCQlmb3IoaW50IGogPWkrMTsgaiA8IE47IGorKykgaWYoR1tpXVtqXSA9PSAwKSB7CgkJCWlmKHBhcnRbal0gIT0gLTEpIHtjb3V0IDw8ICItMVxuIjsgcmV0dXJuIDA7fQoJCQlwYXJ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