#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

template<class T> void print(vector<T> &vec) {
    for(int i = 0; i < (int)vec.size(); ++i) {
        if(i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N);
    vector<vector<int>> visited(N, vector<int>(N));
    rep(i, 0, M) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
    }
    function<void(int, int)> dfs = [&](int cur, int s) {
        visited[s][cur] = 1;
        for(auto &to : G[cur]) {
            if(!visited[s][to]) dfs(to, s);
        }
    };
    rep(i, 0, N) dfs(i, i);
    vector<vector<int>> ans(N);
    rep(i, 0, N) rep(j, 0, N) {
        if(visited[i][j] && visited[j][i]) ans[i].push_back(j + 1);
    }
    rep(i, 0, N) print(ans[i]);
    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 <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

template<class T> void print(vector<T> &vec) {
    for(int i = 0; i < (int)vec.size(); ++i) {
        if(i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N);
    vector<vector<int>> visited(N, vector<int>(N));
    rep(i, 0, M) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
    }
    function<void(int, int)> dfs = [&](int cur, int s) {
        visited[s][cur] = 1;
        for(auto &to : G[cur]) {
            if(!visited[s][to]) dfs(to, s);
        }
    };
    rep(i, 0, N) dfs(i, i);
    vector<vector<int>> ans(N);
    rep(i, 0, N) rep(j, 0, N) {
        if(visited[i][j] && visited[j][i]) ans[i].push_back(j + 1);
    }
    rep(i, 0, N) print(ans[i]);
    return 0;
}


```