#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*4
#define REP(a,b) for(long long a = 0;a < b;++a)
vector<int> vertexs[400];
stack<int> gogo;
int visited[400];
void dfs(int now) {
	REP(q, vertexs[now].size()) {
		int going = vertexs[now][q];
		if (visited[going]) continue;
		visited[going] = 1;
		dfs(going);
	}
	gogo.push(now);
}
vector<int> ans[4000];
vector<int> gyaku[4000];
int main() {
	int n, m;
	cin >> n >> m;
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		vertexs[a].push_back(b);
		gyaku[b].push_back(a);
	}
	REP(i, n) {
		if (!visited[i]) {
			dfs(i);
			while (gogo.empty() == false) {
				int now = gogo.top(); gogo.pop();
				if (visited[now] == 2) continue;
				visited[now] = 2;
				queue<int> can_visit;
				can_visit.push(now);
				vector<int> nya;
				while (can_visit.empty() == false) {
					int now = can_visit.front(); can_visit.pop();
					nya.push_back(now);
					REP(q, gyaku[now].size()) {
						int go = gyaku[now][q];
						if (visited[go] == 1) {
							visited[go] = 2;
							can_visit.push(go);
						}
					}
				}
				REP(q, nya.size()) {
					REP(j, nya.size()) {
						ans[nya[q]].push_back(nya[j]+1);
					}
				}
			}
		}
	}
	
	REP(i, n) {
		sort(ans[i].begin(), ans[i].end());
		REP(q, ans[i].size()) {
			if (q != 0) cout << " ";
			cout << ans[i][q];
		}
		cout << endl;
	}
}

### Prompt

Please provide a cpp coded solution 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
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*4
#define REP(a,b) for(long long a = 0;a < b;++a)
vector<int> vertexs[400];
stack<int> gogo;
int visited[400];
void dfs(int now) {
	REP(q, vertexs[now].size()) {
		int going = vertexs[now][q];
		if (visited[going]) continue;
		visited[going] = 1;
		dfs(going);
	}
	gogo.push(now);
}
vector<int> ans[4000];
vector<int> gyaku[4000];
int main() {
	int n, m;
	cin >> n >> m;
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		vertexs[a].push_back(b);
		gyaku[b].push_back(a);
	}
	REP(i, n) {
		if (!visited[i]) {
			dfs(i);
			while (gogo.empty() == false) {
				int now = gogo.top(); gogo.pop();
				if (visited[now] == 2) continue;
				visited[now] = 2;
				queue<int> can_visit;
				can_visit.push(now);
				vector<int> nya;
				while (can_visit.empty() == false) {
					int now = can_visit.front(); can_visit.pop();
					nya.push_back(now);
					REP(q, gyaku[now].size()) {
						int go = gyaku[now][q];
						if (visited[go] == 1) {
							visited[go] = 2;
							can_visit.push(go);
						}
					}
				}
				REP(q, nya.size()) {
					REP(j, nya.size()) {
						ans[nya[q]].push_back(nya[j]+1);
					}
				}
			}
		}
	}
	
	REP(i, n) {
		sort(ans[i].begin(), ans[i].end());
		REP(q, ans[i].size()) {
			if (q != 0) cout << " ";
			cout << ans[i][q];
		}
		cout << endl;
	}
}

```