#include <bits/stdc++.h>
using namespace std;
vector<int> rooks_[101];
vector<int> a_, b_;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  set<pair<int, int>> set;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    if (a == b or set.count({a, b})) continue;
    set.insert({a, b});
    rooks_[a].push_back((a - 1) * n + b);
    rooks_[b].push_back((a - 1) * n + b);
  }
  for (int c = 1; c <= n; c++) {
    if (rooks_[c].size() == 0) {
      rooks_[c].push_back((c - 1) * n + 1);
    }
    cout << rooks_[c].size() << '\n';
    for (int r : rooks_[c]) {
      cout << c << " " << r << '\n';
    }
  }
  return 0;
}
