#include <bits/stdc++.h>
using namespace std;
const long long maxn = 100005;
vector<long long> adj[maxn];
long long color[maxn], dist[maxn];
bool vis[maxn];
long long cycleLen = -1;
void dfs(long long u) {
  color[u] = 1;
  for (long long v : adj[u]) {
    if (color[v] == 1) {
      cycleLen = max(cycleLen, abs(dist[u] - dist[v]) + 1);
    }
    if (color[v] == 0) {
      dist[v] = dist[u] + 1;
      dfs(v);
    }
  }
  color[u] = 2;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (long long i = 0; i < maxn; i++) {
    color[i] = 0;
    dist[i] = 0;
  }
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v);
  }
  dfs(1);
  vector<long long> vec;
  for (long long i = 1; i * i <= cycleLen; i++) {
    if (cycleLen % i == 0) {
      vec.push_back(i);
      vec.push_back(cycleLen / i);
    }
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (long long d : vec) {
    for (long long i = 0; i <= n; i++) {
      color[i] = 0;
      vis[i] = false;
    }
    queue<long long> q;
    q.push(1);
    vis[1] = true;
    while (!q.empty()) {
      long long u = q.front();
      q.pop();
      for (long long v : adj[u]) {
        if (vis[v]) continue;
        vis[v] = true;
        color[v] = (color[u] + 1) % d;
        q.push(v);
      }
    }
    bool ok = true;
    for (long long u = 1; u <= n; u++) {
      for (long long v : adj[u]) {
        if (color[v] != (color[u] + 1) % d && vis[v] && vis[u]) ok = false;
      }
    }
    if (ok) {
      vector<long long> res;
      for (long long i = 1; i <= n; i++)
        if (color[i] == color[1] && vis[i]) res.push_back(i);
      cout << d << '\n';
      cout << res.size() << '\n';
      for (long long i : res) cout << i << ' ';
      cout << '\n';
      exit(0);
    }
  }
}

### Prompt

Your challenge is to write a cpp solution to the following problem:

In a Berland city S*** there is a tram engine house and only one tram. Three people work in the house — the tram driver, the conductor and the head of the engine house. The tram used to leave the engine house every morning and drove along his loop route. The tram needed exactly c minutes to complete the route. The head of the engine house controlled the tram’s movement, going outside every c minutes when the tram drove by the engine house, and the head left the driver without a bonus if he was even one second late.

It used to be so. Afterwards the Berland Federal Budget gave money to make more tramlines in S***, and, as it sometimes happens, the means were used as it was planned. The tramlines were rebuilt and as a result they turned into a huge network. The previous loop route may have been destroyed. S*** has n crossroads and now m tramlines that links the pairs of crossroads. The traffic in Berland is one way so the tram can move along each tramline only in one direction. There may be several tramlines between two crossroads, which go same way or opposite ways. Every tramline links two different crossroads and for each crossroad there is at least one outgoing tramline.

So, the tramlines were built but for some reason nobody gave a thought to increasing the number of trams in S***! The tram continued to ride alone but now the driver had an excellent opportunity to get rid of the unending control of the engine house head. For now due to the tramline network he could choose the route freely! Now at every crossroad the driver can arbitrarily choose the way he can go. The tram may even go to the parts of S*** from where it cannot return due to one way traffic. The driver is not afraid of the challenge: at night, when the city is asleep, he can return to the engine house safely, driving along the tramlines in the opposite direction.

The city people were rejoicing for some of the had been waiting for the tram to appear on their streets for several years. However, the driver’s behavior enraged the engine house head. Now he tries to carry out an insidious plan of installing cameras to look after the rebellious tram.

The plan goes as follows. The head of the engine house wants to install cameras at some crossroads, to choose a period of time t and every t minutes turn away from the favourite TV show to check where the tram is. Also the head of the engine house wants at all moments of time, divisible by t, and only at such moments the tram to appear on a crossroad under a camera. There must be a camera on the crossroad by the engine house to prevent possible terrorist attacks on the engine house head. Among all the possible plans the engine house head chooses the plan with the largest possible value of t (as he hates being distracted from his favourite TV show but he has to). If such a plan is not unique, pick the plan that requires the minimal possible number of cameras. Find such a plan.

Input

The first line contains integers n and m (2 ≤ n, m ≤ 105) — the number of crossroads and tramlines in S*** respectively. The next m lines contain the descriptions of the tramlines in "u v" format, where u is the initial tramline crossroad and v is its final crossroad. The crossroads are numbered with integers from 1 to n, and the engine house is at the crossroad number 1.

Output

In the first line output the value of t. In the next line output the value of k — the required number of the cameras. In the next line output space-separated numbers of the crossroads, where the cameras should be installed. Output the numbers in increasing order.

Examples

Input

4 5
1 2
2 3
3 4
4 1
1 4


Output

2
2
1 3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long maxn = 100005;
vector<long long> adj[maxn];
long long color[maxn], dist[maxn];
bool vis[maxn];
long long cycleLen = -1;
void dfs(long long u) {
  color[u] = 1;
  for (long long v : adj[u]) {
    if (color[v] == 1) {
      cycleLen = max(cycleLen, abs(dist[u] - dist[v]) + 1);
    }
    if (color[v] == 0) {
      dist[v] = dist[u] + 1;
      dfs(v);
    }
  }
  color[u] = 2;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (long long i = 0; i < maxn; i++) {
    color[i] = 0;
    dist[i] = 0;
  }
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v);
  }
  dfs(1);
  vector<long long> vec;
  for (long long i = 1; i * i <= cycleLen; i++) {
    if (cycleLen % i == 0) {
      vec.push_back(i);
      vec.push_back(cycleLen / i);
    }
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (long long d : vec) {
    for (long long i = 0; i <= n; i++) {
      color[i] = 0;
      vis[i] = false;
    }
    queue<long long> q;
    q.push(1);
    vis[1] = true;
    while (!q.empty()) {
      long long u = q.front();
      q.pop();
      for (long long v : adj[u]) {
        if (vis[v]) continue;
        vis[v] = true;
        color[v] = (color[u] + 1) % d;
        q.push(v);
      }
    }
    bool ok = true;
    for (long long u = 1; u <= n; u++) {
      for (long long v : adj[u]) {
        if (color[v] != (color[u] + 1) % d && vis[v] && vis[u]) ok = false;
      }
    }
    if (ok) {
      vector<long long> res;
      for (long long i = 1; i <= n; i++)
        if (color[i] == color[1] && vis[i]) res.push_back(i);
      cout << d << '\n';
      cout << res.size() << '\n';
      for (long long i : res) cout << i << ' ';
      cout << '\n';
      exit(0);
    }
  }
}

```