#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int m;
  cin >> m;
  vector<vector<int>> v(n);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  vector<vector<pair<int, int>>> ans(n);
  vector<int> lastY(n, 0);
  int y = 1;
  for (int i = 0; i < n; ++i) {
    lastY[i] = y;
    for (int _ = 0; _ < v[i].size() + 1; ++_) {
      ans[i].emplace_back(i + 1, y);
      y++;
    }
    y++;
  }
  for (int i = 0; i < n; ++i) {
    for (int j : v[i]) {
      ans[i].emplace_back(i + 1, lastY[j]);
      lastY[j]++;
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i].size() << endl;
    for (auto &it : ans[i]) {
      cout << it.first << ' ' << it.second << endl;
    }
  }
  return 0;
}
