#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
class SCC {
public:
	int V, cnt;
	vector<vector<int> > G, rG, graph;
	vector<int> vs, cmp;
	vector<bool> used;
	SCC(int node_size) : V(node_size), G(V), rG(V), cmp(V), used(V, false) {}
	void add_edge(int from, int to) {
		G[from].push_back(to);
		rG[to].push_back(from);
	}
	void dfs(int u) {
		used[u] = true;
		for (int v : G[u]) {
			if (!used[v]) {
				dfs(v);
			}
		}
		vs.push_back(u);
	}
	void dfs(int u, const int k) {
		used[u] = true;
		cmp[u] = k;
		for (int v : rG[u]) {
			if (!used[v]) {
				dfs(v, k);
			}
		}
	}
	int solve() { //強連結成分の数を返す
		for (int i = 0; i < V; i++) {
			if (!used[i]) {
				dfs(i);
			}
		}
		fill(used.begin(), used.end(), false);
		cnt = 0;
		for (int i = V - 1; i >= 0; i--) {
			if (!used[vs[i]]) {
				dfs(vs[i], cnt++);
			}
		}
		return cnt;
	}
	void make_graph() {
		graph.resize(cnt);
		for (int i = 0; i < V; i++) {
			for (int v : G[i]) {
				if (cmp[i] != cmp[v]) {
					graph[cmp[i]].push_back(cmp[v]);
				}
			}
		}
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	SCC scc(N);
	int a, b;
	for (int i = 0; i < M; i++) {
		cin >> a >> b; a--; b--;
		scc.add_edge(a, b);
	}
	scc.solve();
	for (int i = 0; i < N; i++) {
		bool f = true;
		for (int j = 0; j < N; j++) {
			if (scc.cmp[i] == scc.cmp[j]) {
				if (f)f = false;
				else cout << " ";
				cout << j + 1;
			}
		}
		cout << endl;
	}
}

### Prompt

Construct a cpp code solution to the problem outlined:

problem

There are $ N $ propositions, named $ 1, 2, \ cdots, N $, respectively. Also, $ M $ information about the propositions is given. The $ i $ th information is "$ a_i $$". Given in the form "b_i $", which means that $ a_i $ is $ b_i $. ("If" is a logical conditional and the transition law holds.) $ For each proposition $ i $ Output all propositions that have the same value as i $ in ascending order. However, proposition $ i $ and proposition $ i $ are always the same value. Proposition $ X $ and proposition $ Y $ have the same value as "$ if $ X $". It means "Y $" and "$ X $ if $ Y $".



output

On the $ i $ line, output all propositions that have the same value as the proposition $ i $, separated by blanks in ascending order. Also, output a line break at the end of each line.

Example

Input

5 2
1 2
2 1


Output

1 2
1 2
3
4
5

### Response

```cpp
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
class SCC {
public:
	int V, cnt;
	vector<vector<int> > G, rG, graph;
	vector<int> vs, cmp;
	vector<bool> used;
	SCC(int node_size) : V(node_size), G(V), rG(V), cmp(V), used(V, false) {}
	void add_edge(int from, int to) {
		G[from].push_back(to);
		rG[to].push_back(from);
	}
	void dfs(int u) {
		used[u] = true;
		for (int v : G[u]) {
			if (!used[v]) {
				dfs(v);
			}
		}
		vs.push_back(u);
	}
	void dfs(int u, const int k) {
		used[u] = true;
		cmp[u] = k;
		for (int v : rG[u]) {
			if (!used[v]) {
				dfs(v, k);
			}
		}
	}
	int solve() { //強連結成分の数を返す
		for (int i = 0; i < V; i++) {
			if (!used[i]) {
				dfs(i);
			}
		}
		fill(used.begin(), used.end(), false);
		cnt = 0;
		for (int i = V - 1; i >= 0; i--) {
			if (!used[vs[i]]) {
				dfs(vs[i], cnt++);
			}
		}
		return cnt;
	}
	void make_graph() {
		graph.resize(cnt);
		for (int i = 0; i < V; i++) {
			for (int v : G[i]) {
				if (cmp[i] != cmp[v]) {
					graph[cmp[i]].push_back(cmp[v]);
				}
			}
		}
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	SCC scc(N);
	int a, b;
	for (int i = 0; i < M; i++) {
		cin >> a >> b; a--; b--;
		scc.add_edge(a, b);
	}
	scc.solve();
	for (int i = 0; i < N; i++) {
		bool f = true;
		for (int j = 0; j < N; j++) {
			if (scc.cmp[i] == scc.cmp[j]) {
				if (f)f = false;
				else cout << " ";
				cout << j + 1;
			}
		}
		cout << endl;
	}
}

```