#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  vector<long long> v[n + 1];
  long long ind[n + 1];
  long long cnt[n + 1];
  vector<long long> ans[n + 1];
  for (long long i = 0, _n = (n + 1); i < _n; i++) {
    ind[i] = -1;
    cnt[i] = 0;
  }
  for (long long i = 0, _n = (m); i < _n; i++) {
    long long c, b;
    cin >> c >> b;
    if (c > b) {
      long long x = b;
      b = c;
      c = x;
    }
    v[b].push_back(c);
    cnt[c]++;
    cnt[b]++;
  }
  long long curr = 1;
  for (long long i = (1), _b = (n); i <= _b; i++) {
    for (long long j = 0, _n = (v[i].size()); j < _n; j++) {
      long long x = v[i][j];
      ans[i].push_back(ind[x]);
      ind[x]++;
      cnt[i]--;
    }
    if (cnt[i] != 0) {
      ind[i] = curr;
      cnt[i]--;
      ans[i].push_back(curr);
      curr++;
    }
    while (cnt[i] != 0) {
      cnt[i]--;
      ans[i].push_back(curr);
      curr++;
    }
  }
  for (long long i = (1), _b = (n); i <= _b; i++) {
    if (ans[i].size() == 0) {
      cout << "1" << endl;
      cout << i << " " << curr << endl;
      curr++;
    } else {
      cout << ans[i].size() << endl;
      for (long long j = 0, _n = (ans[i].size()); j < _n; j++) {
        cout << i << " " << ans[i][j] << endl;
      }
    }
  }
}
