#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 + 5;
const int MAXE = 10000 + 5;
int graph[MAXN][MAXE] = {0};
int main(int argc, const char* argv[]) {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    graph[a - 1][i] = graph[b - 1][i] = 1;
  }
  int last = m;
  for (int i = 0; i < n; i++) {
    int num = 0;
    for (int j = 0; j < m; j++)
      if (graph[i][j] == 1) num++;
    if (num != 0)
      cout << num << endl;
    else
      cout << 1 << endl << i + 1 << " " << ++last << endl;
    for (int j = 0; j < m; j++)
      if (graph[i][j] == 1) cout << i + 1 << " " << j + 1 << endl;
  }
  return 0;
}
