#include <bits/stdc++.h>
using namespace std;
long long md = 1000000007;
int main() {
  std::ios::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  vector<vector<long long> > v(n + 1);
  for (long long i = 1; i < m + 1; i++) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(i);
    v[b].push_back(i);
  }
  for (long long i = 1; i < n + 1; i++) {
    if (v[i].size() == 0) v[i].push_back((long long)1e8 - i);
    cout << v[i].size() << endl;
    for (long long j = 0; j < v[i].size(); j++) {
      cout << i << " " << v[i][j] << endl;
    }
  }
  return 0;
}
