#include <bits/stdc++.h>
using namespace std;
int n, m;
const int N = 1024;
vector<pair<int, int> > result[N];
int visited[N] = {0};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  int x = 1;
  int y = 1;
  int z = 10e5;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    visited[a] = 1;
    visited[b] = 1;
    result[a].push_back(make_pair(a, y));
    result[b].push_back(make_pair(b, y));
    y++;
  }
  for (int i = 1; i <= n; ++i) {
    if (not visited[i]) {
      result[i].push_back(make_pair(i, y++));
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << result[i].size() << "\n";
    for (int j = 0; j < result[i].size(); ++j) {
      cout << result[i][j].first << " " << result[i][j].second << "\n";
    }
  }
  return 0;
}
