#include <bits/stdc++.h>
using namespace std;
const int N = 5050;
int n, m, u, v, col = 1;
vector<pair<int, int>> ans[N];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> u >> v;
    ans[u].push_back({u, col});
    ans[v].push_back({v, col++});
  }
  for (int i = 1; i <= n; ++i) {
    ans[i].push_back({i, col++});
  }
  for (int i = 1; i <= n; ++i) {
    cout << ans[i].size() << endl;
    for (auto& p : ans[i]) {
      cout << p.first << ' ' << p.second << endl;
    }
  }
  return 0;
}
