#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
int inf=1000001000;
ll INF=100000000000000000;

int main() {
    int n,m;
    cin >> n >> m;
    vector<vector<int>> e(n+1,vector<int>(0)),a(n+1,vector<int>(n+1,0));
    rep(i,m){
        int f,g;
        cin >> f >> g;
        e.at(f).push_back(g);
    }
    for (int i=1;i<n+1;i++){
        queue<int> q;
        q.push(i);
        a.at(i).at(i)=1;
        while(!q.empty()){
            int t=q.front();
            q.pop();
            rep(j,e.at(t).size()){
                int u=e.at(t).at(j);
                if (a.at(i).at(u)==0){
                    q.push(u);
                    a.at(i).at(u)=1;
                }
            }
        }
    }
    vector<vector<int>> w(n+1,vector<int>(0));
    rep(i,n){
        rep(j,n){
            if (a.at(i+1).at(j+1)==1 && a.at(j+1).at(i+1)==1) w.at(i+1).push_back(j+1);
        }
    }
    rep(i,n){
        rep(j,w.at(i+1).size()-1) cout << w.at(i+1).at(j) << " ";
        cout << w.at(i+1).at(w.at(i+1).size()-1) << endl;
    }
}


### Prompt

Your task is to create 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 pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
int inf=1000001000;
ll INF=100000000000000000;

int main() {
    int n,m;
    cin >> n >> m;
    vector<vector<int>> e(n+1,vector<int>(0)),a(n+1,vector<int>(n+1,0));
    rep(i,m){
        int f,g;
        cin >> f >> g;
        e.at(f).push_back(g);
    }
    for (int i=1;i<n+1;i++){
        queue<int> q;
        q.push(i);
        a.at(i).at(i)=1;
        while(!q.empty()){
            int t=q.front();
            q.pop();
            rep(j,e.at(t).size()){
                int u=e.at(t).at(j);
                if (a.at(i).at(u)==0){
                    q.push(u);
                    a.at(i).at(u)=1;
                }
            }
        }
    }
    vector<vector<int>> w(n+1,vector<int>(0));
    rep(i,n){
        rep(j,n){
            if (a.at(i+1).at(j+1)==1 && a.at(j+1).at(i+1)==1) w.at(i+1).push_back(j+1);
        }
    }
    rep(i,n){
        rep(j,w.at(i+1).size()-1) cout << w.at(i+1).at(j) << " ";
        cout << w.at(i+1).at(w.at(i+1).size()-1) << endl;
    }
}


```