#include<bits/stdc++.h>
using namespace std;

int n,m;
int G[301][301];
int d[301][301];
int vst[301];

void dfs(int x, int i){
    for (int j=1; j<=n; j++){
        if (G[i][j] && vst[j]==0){
            d[x][j]=1;
            vst[j]=1;
            dfs(x,j);
        }
    }
}

int main(){
    cin>>n>>m;
    for (int i=0; i<m; i++){
        int a,b;
        cin>>a>>b;
        G[a][b]=1;
    }
    for(int i=1; i<=n; i++){
        d[i][i]=1;
        for(int j=1; j<=n; j++){
            vst[j]=0;
        }
        dfs(i,i);
    }
    for (int i=1; i<=n; i++){
        bool flag=true;
        //cout<<"i="<<i<<":";
        for (int j=1; j<=n; j++){
            if(d[i][j] && d[j][i]){
                if(flag){
                    cout<<j;
                    flag=false;
                }else{
                    cout<<' '<<j;
                }
            }
        }
        cout<<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;

int n,m;
int G[301][301];
int d[301][301];
int vst[301];

void dfs(int x, int i){
    for (int j=1; j<=n; j++){
        if (G[i][j] && vst[j]==0){
            d[x][j]=1;
            vst[j]=1;
            dfs(x,j);
        }
    }
}

int main(){
    cin>>n>>m;
    for (int i=0; i<m; i++){
        int a,b;
        cin>>a>>b;
        G[a][b]=1;
    }
    for(int i=1; i<=n; i++){
        d[i][i]=1;
        for(int j=1; j<=n; j++){
            vst[j]=0;
        }
        dfs(i,i);
    }
    for (int i=1; i<=n; i++){
        bool flag=true;
        //cout<<"i="<<i<<":";
        for (int j=1; j<=n; j++){
            if(d[i][j] && d[j][i]){
                if(flag){
                    cout<<j;
                    flag=false;
                }else{
                    cout<<' '<<j;
                }
            }
        }
        cout<<endl;
    }
    return 0;
}

```