#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  vector<vector<long long>> g(n + 1);
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    if (a < b) swap(a, b);
    g[a].push_back(b);
  }
  long long x = 1;
  vector<vector<pair<long long, long long>>> ans(n + 1);
  for (long long i = 1; i <= n; i++) {
    if (g[i].size() == 0) {
      ans[i].push_back({x, i});
      x++;
    }
    for (auto it : g[i]) {
      ans[i].push_back({x, i});
      ans[it].push_back({x, it});
      x++;
    }
  }
  for (long long i = 1; i <= n; i++) {
    cout << ans[i].size() << "\n";
    for (auto it : ans[i]) cout << it.first << " " << it.second << "\n";
  }
  return 0;
}
