#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long double eps = 1e-9;
long long mod = 998244353;
const long long N = 1e6 + 5;
long long n, m;
struct node {
  long long x, y;
} p[N];
long long vis[100][100];
struct edge {
  long long to, nx, w;
} e[N << 1];
long long fi[N];
long long ce = 1;
;
inline void add(long long u, long long v, long long w) {
  e[++ce] = (edge){v, fi[u], w};
  fi[u] = ce;
};
vector<node> vec[105];
signed main() {
  scanf("%lld", &n), scanf("%lld", &m);
  long long a, b;
  memset(fi, -1, sizeof(fi));
  for (long long i = 1; i <= m; i++) {
    scanf("%lld", &a), scanf("%lld", &b);
    add(a, b, 0);
  }
  long long x = 0, y = 0;
  for (long long u = 1; u <= n; u++) {
    x++, y++;
    if (vec[u].size()) {
      node t = vec[u][0];
      vec[u].push_back((node){t.x, y});
    }
    vec[u].push_back((node){x, y});
    long long t = 0;
    for (long long i = fi[u]; ~i; i = e[i].nx) {
      long long v = e[i].to;
      if (vec[v].size()) {
        node t = vec[v][0];
        vec[v].push_back((node){x + 1, t.y});
      }
      vec[v].push_back((node){x + 1, y});
      x++, y++;
      if (vec[u].size()) {
        node t = vec[u][0];
        vec[u].push_back((node){t.x, y});
      }
      vec[u].push_back((node){x, y});
    }
  }
  for (long long i = 1; i <= n; i++) {
    long long sz = vec[i].size();
    for (long long j = 0; j <= sz - 1; j++) {
      vis[vec[i][j].x][vec[i][j].y] = i;
    }
    printf("%lld\n", sz);
    for (long long j = 0; j <= sz - 1; j++)
      printf("%lld %lld\n", vec[i][j].x, vec[i][j].y);
  }
}
