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
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
#define FOR(i,l,r) for(int i=(l);i<=(r);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define ssize(x) int(x.size())
template<class A,class B>auto&operator<<(ostream&o,pair<A,B>p){return o<<'('<<p.first<<", "<<p.second<<')';}
template<class T>auto operator<<(ostream&o,T x)->decltype(x.end(),o){o<<'{';int i=0;for(auto e:x)o<<(", ")+2*!i++<<e;return o<<'}';}
#ifdef DEBUG
#define debug(x...) cerr<<"["#x"]: ",[](auto...$){((cerr<<$<<"; "),...)<<'\n';}(x)
#else
#define debug(...) {}
#endif

struct Dinic {
	using T = int;
	struct Edge {
		int v, u;
		T flow, cap;
	};
	int n;
	vector<vector<int>> graph;
	vector<Edge> edges;

	Dinic(int N) : n(N), graph(n) {}

	void add_edge(int v, int u, T cap) {
		//debug(v, u, cap);
		int e = ssize(edges);
		graph[v].emplace_back(e);
		graph[u].emplace_back(e + 1);
		edges.emplace_back(Edge{v, u, 0, cap});
		edges.emplace_back(Edge{u, v, 0, 0});
	}

	void del_edge(int v, int u) {
		graph[v].pop_back();
		graph[u].pop_back();
		edges.pop_back();
		edges.pop_back();
	}

	vector<int> dist;
	bool bfs(int source, int sink) {
		dist.assign(n, 0);
		dist[source] = 1;
		deque<int> que = {source};
		while(ssize(que) and dist[sink] == 0) {
			int v = que.front();
			que.pop_front();
			for(int e : graph[v])
				if(edges[e].flow != edges[e].cap and dist[edges[e].u] == 0) {
					dist[edges[e].u] = dist[v] + 1;
					que.emplace_back(edges[e].u);
				}
		}
		return dist[sink] != 0;
	}

	vector<int> ended_at;
	T dfs(int v, int sink, T flow = numeric_limits<T>::max()) {
		if(flow == 0 or v == sink)
			return flow;
		for(; ended_at[v] != ssize(graph[v]); ++ended_at[v]) {
			Edge &e = edges[graph[v][ended_at[v]]];
			if(dist[v] + 1 == dist[e.u])
				if(T pushed = dfs(e.u, sink, min(flow, e.cap - e.flow))) {
					e.flow += pushed;
					edges[graph[v][ended_at[v]] ^ 1].flow -= pushed;
					return pushed;
				}
		}
		return 0;
	}

	T operator()(int source, int sink) {
		T answer = 0;
		while(true) {
			if(not bfs(source, sink))
				break;
			ended_at.assign(n, 0);
			while(T pushed = dfs(source, sink))
				answer += pushed;
		}
		return answer;
	}

	map<pair<int, int>, T> get_flowing() {
		map<pair<int, int>, T> ret;
		REP(v, n)
			for(int i : graph[v]) {
				if(i % 2) // considering only original edges
					continue;
				Edge &e = edges[i];
				ret[make_pair(v, e.u)] = e.flow;
			}
		return ret;
	}
};

int main() {
	cin.tie(0)->sync_with_stdio(0);

	int n, m, k;
	cin >> n >> m >> k;
	const int S = 2 * n;
	const int T = 2 * n + 1;
	Dinic dinic(2 * n + 2);
	REP(i,k) {
		dinic.add_edge(S, i, 1);
	}
	REP(i,n) {
		dinic.add_edge(i, i + n, 1);
	}
	REP(i,m) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		dinic.add_edge(a + n, b, 1);
	}
	vector<LL> ans(k + 1);
	FOR(i,k,n-1) {
		int sum = 0;
		FOR(j,i,n-1) {
			dinic.add_edge(j + n, T, 1);
			sum += dinic(S, T);
			++ans[sum];
			debug(i, j, sum);
		}
		dinic(T, S);
		FOR(j,i,n-1) {
			dinic.del_edge(j + n, T);
		}
	}
	REP(i,k+1) {
		cout << ans[i] << '\n';
	}
}