#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[5001];
vector<pair<long long int, long long int>> v[101];
long long int n, m;
long long int cnt;
long long int it[101];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  long long int i, j, k;
  cnt = n + 1;
  j = 1;
  for (i = 1; i <= 100; ++i, j += 102) {
    it[i] = j;
  }
  for (i = 0; i < m; ++i) {
    cin >> j >> k;
    if (j > k) {
      adj[k].push_back(j);
    } else {
      adj[j].push_back(k);
    }
  }
  for (i = 1; i <= n; ++i) {
    long long int len = adj[i].size();
    v[i].push_back(make_pair(i, it[i]));
    it[i]++;
    for (j = 0; j < len; ++j) {
      v[i].push_back(make_pair(i, it[i]));
      v[adj[i][j]].push_back(make_pair(adj[i][j], it[i]));
      it[i]++;
    }
  }
  for (i = 1; i <= n; ++i) {
    long long int len = v[i].size();
    cout << v[i].size() << endl;
    for (j = 0; j < len; ++j) {
      cout << v[i][j].first << " " << v[i][j].second << endl;
    }
  }
  return 0;
}
