#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double PI = 3.14159265358979323846264338f;
const double pi = acos(-1.0);
const int maxn = 100;
const int inf = 0x3f3f3f3f;
const int dirx[] = {0, 0, 1, -1};
const int diry[] = {1, -1, 0, 0};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int y = 0;
  vector<vector<int>> cord(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    cord[a].push_back(y);
    cord[b].push_back(y);
    y++;
  }
  for (int i = 0; i < n; i++) {
    cord[i].push_back(y);
    y++;
  }
  for (int i = 0; i < n; i++) {
    cout << cord[i].size() << '\n';
    for (int j = 0; j < cord[i].size(); j++) {
      cout << i + 1 << ' ' << cord[i][j] + 1 << '\n';
    }
  }
  return 0;
}
