#include <bits/stdc++.h>
#pragma GCC optimize "-O3"
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const long long MOD = 998244353;
const int MAXN = (int)3e5 + 500;
const double EPS = 1e-10;
const double PI = 3.14159265358979323846;
const int SZ = 550;
const long long INF = 5e14 + 3;
long long n, m, k, l;
pair<long long, long long> edg[MAXN];
vector<pair<long long, long long> > pos[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> edg[i].first >> edg[i].second;
    pos[edg[i].first].push_back(make_pair(1 + i * n, edg[i].first));
    pos[edg[i].second].push_back(make_pair(1 + i * n, edg[i].second));
  }
  int val = m + 1;
  for (int i = 1; i <= n; i++) {
    if (pos[i].size()) {
      cout << pos[i].size() << "\n";
      for (pair<long long, long long> p : pos[i])
        cout << p.first << " " << p.second << "\n";
    } else {
      cout << "1\n";
      cout << 1 + n * val << " " << i << "\n";
      val++;
    }
  }
}
