#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 305

int N,M;
bool can_go[SIZE][SIZE];

int main(){

	scanf("%d %d",&N,&M);

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){

			can_go[i][k] = (i == k);
		}
	}

	int from,to;

	for(int loop = 0; loop < M; loop++){

		scanf("%d %d",&from,&to);
		from--;
		to--;

		can_go[from][to] = true;
	}

	for(int mid = 0; mid < N; mid++){
		for(int start = 0; start < N; start++){
			if(!can_go[start][mid])continue;
			for(int goal = 0; goal < N; goal++){
				if(!can_go[mid][goal])continue;

				can_go[start][goal] = true;
			}
		}
	}

	for(int i = 0; i < N; i++){
		bool is_First = true;
		for(int k = 0; k < N; k++){
			if(can_go[i][k] && can_go[k][i]){
				if(is_First){

					printf("%d",k+1);
					is_First = false;
				}else{

					printf(" %d",k+1);
				}
			}
		}
		printf("\n");
	}

	return 0;
}


### Prompt

Create a solution in CPP for the following problem:

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>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 305

int N,M;
bool can_go[SIZE][SIZE];

int main(){

	scanf("%d %d",&N,&M);

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++){

			can_go[i][k] = (i == k);
		}
	}

	int from,to;

	for(int loop = 0; loop < M; loop++){

		scanf("%d %d",&from,&to);
		from--;
		to--;

		can_go[from][to] = true;
	}

	for(int mid = 0; mid < N; mid++){
		for(int start = 0; start < N; start++){
			if(!can_go[start][mid])continue;
			for(int goal = 0; goal < N; goal++){
				if(!can_go[mid][goal])continue;

				can_go[start][goal] = true;
			}
		}
	}

	for(int i = 0; i < N; i++){
		bool is_First = true;
		for(int k = 0; k < N; k++){
			if(can_go[i][k] && can_go[k][i]){
				if(is_First){

					printf("%d",k+1);
					is_First = false;
				}else{

					printf(" %d",k+1);
				}
			}
		}
		printf("\n");
	}

	return 0;
}


```