#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  map<int, vector<pair<int, int> > > mp;
  for (int i = 1; i <= n; i++) {
    mp[i].push_back({i, i});
  }
  int j = n + 1;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    mp[u].push_back({j, u});
    mp[v].push_back({j, v});
    j++;
  }
  for (int i = 1; i <= n; i++) {
    cout << mp[i].size() << endl;
    for (auto val : mp[i]) {
      cout << val.first << " " << val.second << endl;
    }
  }
  return 0;
}
