#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<int> G[105];
int now;
vector<int> y[105];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  int u, v;
  for (int i = 1; i <= M; i++) {
    cin >> u >> v;
    if (u > v) swap(u, v);
    G[v].push_back(u);
  }
  now = 1;
  for (int i = 1; i <= N; i++) {
    y[i].push_back(now++);
    for (int j : G[i]) {
      y[j].push_back(now);
      y[i].push_back(now++);
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << (int)y[i].size() << '\n';
    for (int yi : y[i]) cout << i << ' ' << yi << '\n';
  }
  return 0;
}
