#include<iostream>
#include<vector>
using namespace std;

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

    vector<vector<int>> v(n, vector<int>(n, 1<<30));
    for(int i = 0; i < n; i++)  v[i][i] = 0;
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a][b] = 1;
    }

    for(int k = 0; k < n; k++){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if(v[i][k] == 1<<30 || v[k][j] == 1<<30)   continue;
                v[i][j] = min(v[i][j], v[i][k]+v[k][j]);
            }
        }
    }

    vector<int> ans[n];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(v[i][j] != 1<<30 && v[j][i] != 1<<30)    ans[i].push_back(j);
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < ans[i].size(); j++){
            cout << ans[i][j]+1 << " \n"[j+1==ans[i].size()];
        }
    }
    
    return 0;
}

### Prompt

Your challenge is to write a Cpp solution to 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<iostream>
#include<vector>
using namespace std;

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

    vector<vector<int>> v(n, vector<int>(n, 1<<30));
    for(int i = 0; i < n; i++)  v[i][i] = 0;
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a][b] = 1;
    }

    for(int k = 0; k < n; k++){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if(v[i][k] == 1<<30 || v[k][j] == 1<<30)   continue;
                v[i][j] = min(v[i][j], v[i][k]+v[k][j]);
            }
        }
    }

    vector<int> ans[n];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(v[i][j] != 1<<30 && v[j][i] != 1<<30)    ans[i].push_back(j);
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < ans[i].size(); j++){
            cout << ans[i][j]+1 << " \n"[j+1==ans[i].size()];
        }
    }
    
    return 0;
}

```