#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using LD = long double;
using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pld = pair<LD, LD>;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> res_line(n + 1);
  for (int color = 1; color <= n; ++color) {
    res_line[color].emplace_back(color);
  }
  for (int first_empty_line = n + 1; m--; ++first_empty_line) {
    int col1, col2;
    cin >> col1 >> col2;
    res_line[col1].emplace_back(first_empty_line);
    res_line[col2].emplace_back(first_empty_line);
  }
  for (int color = 1; color <= n; ++color) {
    cout << res_line[color].size() << "\n";
    for (const int &line : res_line[color]) {
      cout << line << " " << color << "\n";
    }
  }
}
