#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

vector<int> g[303];
vector<int> v[303];

bool visg[303];
bool visv[303];

void dfsg(int now){
  visg[now]=true;
  for(auto nex:g[now]){
    if(visg[nex]) continue;
    dfsg(nex);
  }
}

void dfsv(int now){
  visv[now]=true;
  for(auto nex:v[now]){
    if(visv[nex]) continue;
    dfsv(nex);
  }
}


int N,M;
vector<int> A,B;

int main(){
  cin>>N>>M;
  A.resize(M);
  B.resize(M);

  for(int i=0;i<M;i++) cin>>A[i]>>B[i];

  for(int i=0;i<M;i++){
    g[A[i]].push_back(B[i]);
    v[B[i]].push_back(A[i]);
  }

  for(int i=1;i<=N;i++){
    dfsg(i);
    dfsv(i);

    vector<int> ans;
    for(int j=1;j<=N;j++){
      if(visg[j]&&visv[j]) ans.push_back(j);
      visg[j]=false;
      visv[j]=false;
    }

    for(int j=0;j<ans.size();j++){
      cout<<ans[j];
      if(j+1<ans.size()) cout<<" ";
    }
    cout<<endl;
  }

  return 0;
}


### Prompt

Please create a solution in cpp 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 <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

vector<int> g[303];
vector<int> v[303];

bool visg[303];
bool visv[303];

void dfsg(int now){
  visg[now]=true;
  for(auto nex:g[now]){
    if(visg[nex]) continue;
    dfsg(nex);
  }
}

void dfsv(int now){
  visv[now]=true;
  for(auto nex:v[now]){
    if(visv[nex]) continue;
    dfsv(nex);
  }
}


int N,M;
vector<int> A,B;

int main(){
  cin>>N>>M;
  A.resize(M);
  B.resize(M);

  for(int i=0;i<M;i++) cin>>A[i]>>B[i];

  for(int i=0;i<M;i++){
    g[A[i]].push_back(B[i]);
    v[B[i]].push_back(A[i]);
  }

  for(int i=1;i<=N;i++){
    dfsg(i);
    dfsv(i);

    vector<int> ans;
    for(int j=1;j<=N;j++){
      if(visg[j]&&visv[j]) ans.push_back(j);
      visg[j]=false;
      visv[j]=false;
    }

    for(int j=0;j<ans.size();j++){
      cout<<ans[j];
      if(j+1<ans.size()) cout<<" ";
    }
    cout<<endl;
  }

  return 0;
}


```