#include <bits/stdc++.h>
using namespace std;
vector<int> vec[103];
int n, m, h = 1, x, y;
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    vec[x].push_back(h);
    vec[y].push_back(h);
    h++;
  }
  for (int i = 1; i <= n; i++)
    if (vec[i].empty()) vec[i].push_back(h++);
  for (int i = 1; i <= n; i++) {
    cout << vec[i].size() << '\n';
    for (int j = 0; j < vec[i].size(); j++) {
      cout << i << " " << vec[i][j] << '\n';
    }
  }
}
