#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;
long long readInt() {
  bool minus1 = false;
  long long result = 0;
  char ch;
  ch = getchar();
  while (true) {
    if (ch == '-') break;
    if (ch >= '0' && ch <= '9') break;
    ch = getchar();
  }
  if (ch == '-')
    minus1 = true;
  else
    result = ch - '0';
  while (true) {
    ch = getchar();
    if (ch < '0' || ch > '9') break;
    result = result * 10 + (ch - '0');
  }
  if (minus1)
    return -result;
  else
    return result;
}
const int N = 111;
vector<pair<int, int> > g[N];
int main() {
  int n = readInt(), m = readInt();
  for (int i = 1; i <= m; i++) {
    int x = readInt(), y = readInt();
    g[x].push_back({x, y + n * i});
    g[y].push_back({y, y + n * i});
  }
  for (int i = 1; i <= n; i++) g[i].push_back({i, i});
  for (int i = 1; i <= n; i++) {
    cout << g[i].size() << '\n';
    for (pair<int, int> j : g[i]) {
      cout << j.first << ' ' << j.second << '\n';
    }
  }
  return 0;
}
