#include <bits/stdc++.h>
using namespace std;
int movei[] = {0, 0, 1, -1, 1, 1, -1, -1};
int movej[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int N = 1e5 + 1;
vector<int> g[200];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  vector<vector<pair<int, int> > > pos(n + 1);
  int col = n + 1;
  vector<bool> vis(n + 1, false);
  for (int i = 1; i <= n; i++) {
    pos[i].push_back({i, i});
    vis[i] = true;
    for (int x : g[i]) {
      if (!vis[x]) {
        pos[i].push_back({i, col});
        pos[x].push_back({x, col});
        col++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << pos[i].size() << '\n';
    for (auto p : pos[i]) {
      cout << p.first << ' ' << p.second << '\n';
    }
  }
}
