#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> a[105], vis(105, 0);
vector<pair<int, int> > ans[105];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    int r1, r2;
    cin >> r1 >> r2;
    a[r1].push_back(r2);
    a[r2].push_back(r1);
  }
  int c = 1;
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      if (a[i].size() == 0) {
        ans[i].push_back({i, c});
        ++c;
        vis[i] = 1;
        continue;
      }
      queue<int> q;
      q.push(i);
      vis[i] = 1;
      while (!q.empty()) {
        int us = q.front();
        q.pop();
        for (auto it : a[us]) {
          ans[us].push_back({us, c});
          ans[it].push_back({it, c});
          ++c;
          if (!vis[it]) {
            vis[it] = 1;
            q.push(it);
          }
        }
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << ans[i].size() << "\n";
    for (auto it : ans[i]) {
      cout << it.first << " " << it.second << "\n";
    }
  }
  return 0;
}
