/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    ll a[100010], b[100010];
    map<lpair, ll> mp;
    rep(i,0,M){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        mp[make_pair(a[i], b[i])]++;
    }
    ll dist[310][310] = {};
    rep(i,0,N){
        rep(j,0,N){
            dist[i][j] = INF;
            if(i == j) dist[i][j] = 0;
        }
    }
    rep(i,0,M){
        dist[a[i]][b[i]] = 1;
    }
    rep(k,0,N){
        rep(i,0,N){
            rep(j,0,N){
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    vector<ll> ans[310];
    rep(i,0,N){
        rep(j,0,N){
            if(dist[i][j] != INF && dist[j][i] != INF) ans[i].push_back(j+1);
        }
    }
    rep(i,0,N){
        ll sz = ans[i].size();
        rep(j,0,sz){
            cout << ans[i][j] << " \n"[j==sz-1];
        }
    }

    
}

### 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
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    ll a[100010], b[100010];
    map<lpair, ll> mp;
    rep(i,0,M){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        mp[make_pair(a[i], b[i])]++;
    }
    ll dist[310][310] = {};
    rep(i,0,N){
        rep(j,0,N){
            dist[i][j] = INF;
            if(i == j) dist[i][j] = 0;
        }
    }
    rep(i,0,M){
        dist[a[i]][b[i]] = 1;
    }
    rep(k,0,N){
        rep(i,0,N){
            rep(j,0,N){
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    vector<ll> ans[310];
    rep(i,0,N){
        rep(j,0,N){
            if(dist[i][j] != INF && dist[j][i] != INF) ans[i].push_back(j+1);
        }
    }
    rep(i,0,N){
        ll sz = ans[i].size();
        rep(j,0,sz){
            cout << ans[i][j] << " \n"[j==sz-1];
        }
    }

    
}

```