#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int>>> G;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  G.resize(n + 1);
  for (int i = 1; i <= n; i++) G[i].push_back(make_pair(i, i));
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    G[a].push_back(make_pair(n + i + 1, a));
    G[b].push_back(make_pair(n + i + 1, b));
  }
  for (int i = 1; i <= n; i++) {
    printf("%d\n", (int)G[i].size());
    for (int j = 0; j < G[i].size(); j++)
      printf("%d %d\n", G[i][j].first, G[i][j].second);
  }
}
