#include <bits/stdc++.h>
using namespace std;
void shoot() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  shoot();
  long long i, j, x, y, n, m, cnt = 1, inf = (long long)1e9;
  cin >> n >> m;
  vector<long long> v[n + 1];
  while (m--) {
    cin >> x >> y;
    v[min(x, y)].push_back(max(x, y));
  }
  vector<pair<long long, long long> > ans[n + 1];
  for (i = 1; i <= n; i++) {
    for (j = 0; j < v[i].size(); j++) {
      ans[i].push_back(make_pair(i, cnt));
      ans[v[i][j]].push_back(make_pair(v[i][j], cnt++));
    }
  }
  for (i = 1; i <= n; i++) {
    if (ans[i].size() == 0) {
      cout << 1 << endl << inf << " " << inf-- << endl;
      continue;
    }
    cout << ans[i].size() << endl;
    for (j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j].first << " " << ans[i][j].second << endl;
    }
  }
  return 0;
}
