#include <bits/stdc++.h>
using namespace std;
long long dx4[4] = {0, 1, 0, -1};
long long dy4[4] = {1, 0, -1, 0};
long long dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
long long dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<pair<long long, long long> > v[n + 1];
  for (long long i = 1; i <= n; i++) v[i].push_back(make_pair(i, i));
  long long j = n + 1;
  while (m--) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(make_pair(j, a));
    v[b].push_back(make_pair(j, b));
    j++;
  }
  for (long long i = 1; i <= n; i++) {
    cout << v[i].size() << '\n';
    for (auto p : v[i]) cout << p.first << " " << p.second << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}
