#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long n, m;
  cin >> n >> m;
  vector<vector<long>> rooks(n + 1);
  for (long i = 1; i <= n; i++) rooks[i].push_back(i * n + i);
  for (long i = 0; i < m; i++) {
    long x, y;
    cin >> x >> y;
    rooks[x].push_back(x * n + y);
    rooks[y].push_back(x * n + y);
  }
  for (long i = 1; i <= n; i++) {
    cout << rooks[i].size() << "\n";
    for (long j = 0; j < rooks[i].size(); j++) {
      cout << i << " " << rooks[i][j] << "\n";
    }
  }
  return 0;
}
