#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void SetUp() {
  srand(chrono::steady_clock::now().time_since_epoch().count() % UINT_MAX);
}
int n, m;
vector<vector<int>> adj;
void Load() {
  scanf("%d%d", &n, &m);
  adj.resize(n + 1);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
}
void Solve() {
  vector<bool> vis(n + 1, false);
  vector<vector<pair<int, int>>> ans;
  ans.resize(n + 1);
  for (int i = 1; i <= n; ++i) {
    ans[i].emplace_back(i, i);
  }
  int cury = n + 1;
  for (int i = 1; i <= n; ++i) {
    if (vis[i]) continue;
    vector<int> all_in_cc;
    queue<int> q;
    vis[i] = true;
    q.push(i);
    all_in_cc.push_back(i);
    while (!q.empty()) {
      int front = q.front();
      q.pop();
      for (int j : adj[front]) {
        if (vis[j]) continue;
        vis[j] = true;
        q.push(j);
        all_in_cc.push_back(j);
      }
    }
    for (int j : all_in_cc) {
      for (int k : adj[j]) {
        if (j < k) {
          ans[j].emplace_back(j, cury);
          ans[k].emplace_back(k, cury++);
        }
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d\n", ans[i].size());
    for (const auto& pr : ans[i]) {
      printf("%d %d\n", pr.first, pr.second);
    }
  }
}
int main() {
  SetUp();
  Load();
  Solve();
}
