#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5;
long long n, m;
vector<long long> g[N];
inline long long read() {
  long long ret = 0, f = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) {
    ret = ret * 10 + c - 48;
    c = getchar();
  }
  if (f) return -ret;
  return ret;
}
signed main() {
  n = read();
  m = read();
  for (long long i = 1; i <= m; i++) {
    long long x = read(), y = read();
    g[x].push_back(i);
    g[y].push_back(i);
  }
  long long tot = m;
  for (long long i = 1; i <= n; i++) {
    if (!g[i].size()) {
      puts("1");
      printf("%lld %lld\n", i, ++tot);
      continue;
    }
    printf("%lld\n", (long long)g[i].size());
    for (long long j = 0; j < g[i].size(); j++)
      printf("%lld %lld\n", i, g[i][j]);
  }
  return 0;
}
