#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e4 + 7;
vector<pair<int, int> > vec[maxn];
int n, m, t, u, v;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    vec[u].push_back(make_pair(u, i));
    vec[v].push_back(make_pair(v, i));
  }
  t = m + 1;
  for (int i = 1; i <= n; i++) {
    if (vec[i].empty()) {
      vec[i].push_back(make_pair(i, t));
      t++;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << vec[i].size() << endl;
    for (auto j : vec[i]) {
      cout << j.first << " " << j.second << endl;
    }
  }
  return 0;
}
