#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, m;
  cin >> n >> m;
  vector<pair<long long, long long>> a(m);
  vector<vector<long long>> g(n);
  for (long long i = 0; i < m; i++) {
    cin >> a[i].first >> a[i].second;
    if (--a[i].first > --a[i].second) swap(a[i].first, a[i].second);
    g[a[i].first].push_back(a[i].second);
  }
  vector<long long> col(n, 0), pr(n + 1, 0);
  vector<vector<pair<long long, long long>>> c(n);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < g[i].size(); j++) c[i].push_back({i, pr[i] + j});
    pr[i + 1] = pr[i] + g[i].size();
    for (long long j = 0; j < g[i].size(); j++) {
      c[g[i][j]].push_back({g[i][j], pr[i] + j});
    }
    if (g[i].size() == 0) {
      c[i].push_back({i, pr[i]});
      pr[i + 1] = pr[i] + 1;
    }
  }
  for (long long i = 0; i < n; i++) {
    cout << c[i].size() << "\n";
    for (auto j : c[i]) cout << j.first + 1 << " " << j.second + 1 << "\n";
  }
  return 0;
}
