#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;
vector<int> v[105], adj[105];
int st[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  while (m--) {
    int u, vv;
    cin >> u >> vv;
    adj[u].push_back(vv);
    adj[vv].push_back(u);
  }
  int id = 1;
  for (int i = 1; i <= n; i++) {
    sort(adj[i].begin(), adj[i].end());
    st[i] = id;
    for (int j = 0; j < max(1, (int)adj[i].size()); j++) {
      v[i].push_back(id++);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < adj[i].size(); j++) {
      int x = adj[i][j];
      int idx = lower_bound(adj[x].begin(), adj[x].end(), i) - adj[x].begin();
      v[i].push_back(st[adj[i][j]] + idx);
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << (int)v[i].size() << '\n';
    for (auto j : v[i]) cout << i << ' ' << j << '\n';
  }
  return 0;
}
