#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, i, j, u, v, k;
  cin >> n >> m;
  vector<pair<int, int> > locs[n + 1];
  for (i = 1; i <= n; i++) locs[i].push_back(make_pair(i, i));
  k = n + 1;
  for (i = 1; i <= m; i++) {
    cin >> u >> v;
    if (u > v) {
      j = u;
      u = v;
      v = j;
    }
    locs[v].push_back(make_pair(k, k));
    locs[v].push_back(make_pair(v, k));
    locs[u].push_back(make_pair(u, k));
    k++;
  }
  for (i = 1; i <= n; i++) {
    cout << locs[i].size() << endl;
    for (auto pp : locs[i]) cout << pp.first << " " << pp.second << endl;
  }
  return 0;
}
