#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans[10000];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    ans[i].push_back({10000000 - i, i});
  }
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    ans[l - 1].push_back({i + 1, l - 1});
    ans[r - 1].push_back({i + 1, r - 1});
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i].size() << '\n';
    for (int j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j].first + 1 << " " << ans[i][j].second + 1 << '\n';
    }
  }
}
