#include <bits/stdc++.h>
using namespace std;
int n, m, u, v;
vector<pair<int, int> > pos[100001];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) pos[i].push_back({i, i});
  for (int i = 1; i <= m; ++i) {
    cin >> u >> v;
    pos[u].push_back({u, n + i});
    pos[v].push_back({v, n + i});
  }
  for (int i = 1; i <= n; ++i) {
    cout << pos[i].size() << '\n';
    for (int j = 0; j < pos[i].size(); ++j)
      cout << pos[i][j].first << " " << pos[i][j].second << '\n';
  }
  return 0;
}
