#include <bits/stdc++.h>
using namespace std;
int i, j;
const int M = 1e5 + 2;
pair<int, int> colors[1006];
vector<pair<int, int> > ans[106];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    cin >> colors[i].first >> colors[i].second;
  }
  sort(colors, colors + m);
  int currh = 1;
  for (i = 0; i < m; i++) {
    ans[colors[i].first].push_back({currh, colors[i].first});
    ans[colors[i].second].push_back({currh, colors[i].second});
    currh++;
  }
  for (i = 1; i <= n; i++) {
    if (ans[i].empty()) {
      cout << "1\n" << currh << " " << i << "\n";
      currh++;
      continue;
    }
    cout << ans[i].size() << "\n";
    for (auto x : ans[i]) {
      cout << x.first << " " << x.second << "\n";
    }
  }
}
