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
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("trapv")

#define st first
#define nd second
#define pb(x) push_back(x)
#define pp(x) pop_back(x)
#define mp(a, b) make_pair(a, b)
#define all(x) (x).begin(), (x).end()
#define rev(x) reverse(all(x))
#define sor(x) sort(all(x))
#define sz(x) (int)(x).size()
#define rsz(x) resize(x)

using namespace std;

///~~~~~~~~~~~~~~~~~~~~~~~~~~

void debug(){cerr<<"\n";}
template <typename H, typename... T>
void debug(H h, T... t) {cerr<<h; if (sizeof...(t)) cerr << ", "; debug(t...);}
#define deb(x...) cerr<<#x<<" = ";debug(x);

///~~~~~~~~~~~~~~~~~~~~~~~~~

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii > vii;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef string str;

#define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

const int N=2e5+5, INF=1e9+5, mod=1e9+7;

//https://cp-algorithms.com/graph/dinic.html
int n, m, k, akt;
int ans[N];
struct flow{
	using T=int;
	const T inf=numeric_limits<T>::max();
	struct Edge{
		int v, u;
		T cap, flo=0;
		Edge(int v, int u, T cap) : v(v), u(u), cap(cap){}
	};
	int nn, s, t;
	vector<vi> adj;
	vi par, lev;
	vector<Edge> edg;
	flow(int nn, int s, int t):nn(nn), s(s), t(t){
		adj.rsz(nn);
		par.rsz(nn);
		lev.rsz(nn);
	}
	void ae(int u, int v, T cap){
		adj[u].pb(sz(edg));
		edg.pb(Edge(u, v, cap));
		adj[v].pb(sz(edg));
		edg.pb(Edge(v, u, 0));
	}
	int bfs(){
		fill(all(lev), -1);
		fill(all(par), 0);
		vi V;
		V.pb(s);
		lev[s]=0;
		for(int i=0; i<sz(V); i++){
			int v=V[i];
			if(v==t)continue;
			for(int e:adj[v]){
				if(edg[e].flo!=edg[e].cap && lev[edg[e].u]==-1){
					lev[edg[e].u]=lev[v]+1;
					par[edg[e].u]=e;
					V.pb(edg[e].u);
				}
			}
		}
		int dobry=0;
		for(int v=akt+n; v>n; v--){
			if(lev[v]==-1)continue;
			for(int e:adj[v]){
				if(edg[e].flo!=edg[e].cap && edg[e].u==t){
					//cout<<"a"<<v-n<<" \n";
					dobry=v-n;
					edg[e].flo++;
					edg[e^1].flo--;
					while(v!=s){
						//cout<<v<<""
						edg[par[v]].flo++;
						edg[par[v]^1].flo--;
						v=edg[par[v]].v;
					}
					break;
				}
			}
			if(dobry)break;

		}
		//for(int i=0; i<nn; i++){
		//	cout<<lev[i]<<" \n"[i%n==0];
		//}
		//cout<<"\n";
		//cout<<dobry<<"q\n";
		return dobry;
	}
	void czysc(){
		for(auto &e:edg){
			e.flo=0;
		}
		//edg.pp();
		//edg.pp();
	}
	void solve(){
		int wsk=akt;
		int ile=0;
		while(wsk>k){
			int id=bfs();
			if(id==0)id=k;
			while(wsk>id)ans[ile]++, wsk--;
			ile++;
			wsk=id;
		}
		//cout<<"\n\n";
	}
};
int main(){
	//BOOST;
	cin>>n>>m>>k;
	flow T(2*n+2, 0, 2*n+1);
	for(int i=1; i<=n; i++){
		if(i<=k)T.ae(0, i, 1);
		T.ae(i, n+i, 1);
	}
	for(int i=0; i<m; i++){
		int u, v;
		cin>>u>>v;
		T.ae(u+n, v, 1);
	}
	for(int i=k+1; i<=n; i++){
		T.ae(i+n, n+n+1, 1);
	}
	akt=n;
	for(; akt>k; akt--){
		T.solve();
		T.czysc();
		//cout<<ans[0]+ans[1]+ans[2]<<"tt\n\n";
	}
	//T.solve();
	for(int i=0; i<=k; i++){
		cout<<ans[i]<<"\n";
	}
}