#include <bits/stdc++.h>

using namespace std;

#define ll long long

//#define TEST

vector<vector<int>> g(300);

// logic[i][j] := ?「iならばj」
int logic[300][300];

vector<int> visited(300);
int start;
void dfs(int s) {
	visited[s] = 1;
	for (auto t : g[s]) {
		if (!(visited[t])) {
			visited[t] = 1;
			logic[start][t] = 1;
			dfs(t);
		}
	}
}

signed main() {
	int n, m;
	cin >> n >> m;

	for (int i = 0; i < m; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		g[a].push_back(b);
	}

	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			logic[i][j] = 0;
	for (int i = 0; i < n; ++i)
		logic[i][i] = 1;

	for (int i = 0; i < n; ++i) {
		start = i;
		for (int j = 0; j < n; ++j)
			visited[j] = 0;
		dfs(start);
	}

#ifdef TEST
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j)
			cout << logic[i][j] << " ";
		cout << endl;
	}
#endif

	for (int i = 0; i < n; ++i) {
		vector<int> ans;
		for (int j = 0; j < n; ++j)
			if (logic[i][j] && logic[j][i])
				ans.push_back(j + 1);
		for (int j = 0; j < ans.size() - 1; ++j)
			cout << ans[j] << " ";
		cout << ans[ans.size() - 1] << endl;
	}

	return 0;
}

### Prompt

Develop a solution in CPP to the problem described below:

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 <bits/stdc++.h>

using namespace std;

#define ll long long

//#define TEST

vector<vector<int>> g(300);

// logic[i][j] := ?「iならばj」
int logic[300][300];

vector<int> visited(300);
int start;
void dfs(int s) {
	visited[s] = 1;
	for (auto t : g[s]) {
		if (!(visited[t])) {
			visited[t] = 1;
			logic[start][t] = 1;
			dfs(t);
		}
	}
}

signed main() {
	int n, m;
	cin >> n >> m;

	for (int i = 0; i < m; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		g[a].push_back(b);
	}

	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			logic[i][j] = 0;
	for (int i = 0; i < n; ++i)
		logic[i][i] = 1;

	for (int i = 0; i < n; ++i) {
		start = i;
		for (int j = 0; j < n; ++j)
			visited[j] = 0;
		dfs(start);
	}

#ifdef TEST
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j)
			cout << logic[i][j] << " ";
		cout << endl;
	}
#endif

	for (int i = 0; i < n; ++i) {
		vector<int> ans;
		for (int j = 0; j < n; ++j)
			if (logic[i][j] && logic[j][i])
				ans.push_back(j + 1);
		for (int j = 0; j < ans.size() - 1; ++j)
			cout << ans[j] << " ";
		cout << ans[ans.size() - 1] << endl;
	}

	return 0;
}

```