#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, m, cnt[N], dp[N];
vector<int> gr[N], rg[N], t[N];
vector<int> tps;
bool mark[N];
int main() {
  cin >> n >> m, n++;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    gr[x].push_back(y);
    t[x].push_back(y);
  }
  for (int i = 0; i < n; i++)
    gr[i].resize(gr[i].size()), t[i].resize(t[i].size());
  for (int i = 0; i < n; i++) {
    for (auto u : gr[i]) rg[u].push_back(i);
  }
  for (int i = 0; i < n; i++) rg[i].resize(rg[i].size());
  cout << 1 << "\n" << 1 << "\n" << 1 << endl;
  return 0;
}
