#include <bits/stdc++.h>
using namespace std;
int arr[101][1001];
int n, m;
int g[101][101];
vector<int> col[1001];
set<int> row[101];
bool ans[101][101];
int main() {
  scanf("%d", &n), scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d", &x), scanf("%d", &y);
    g[x][y] = g[y][x] = 1;
  }
  for (int i = 1; i <= n; ++i) g[i][i] = true;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (g[i][j] && !ans[i][j]) {
        for (int k = 0; k < 1001; ++k)
          if (col[k].size() == 0) {
            arr[i][k] = i;
            arr[j][k] = j;
            col[k].push_back(i), col[k].push_back(j);
            break;
          } else {
            bool ok = true;
            for (int l = 0; l < col[k].size(); ++l) {
              int cur = col[k][l];
              if (!g[cur][i] || !g[cur][j]) {
                ok = false;
                break;
              }
            }
            if (ok) {
              arr[i][k] = i;
              arr[j][k] = j;
              for (int l = 0; l < col[k].size(); ++l) {
                int cur = col[k][l];
                ans[cur][i] = ans[i][cur] = ans[j][cur] = ans[cur][j] = true;
              }
              col[k].push_back(i), col[k].push_back(j);
              break;
            }
          }
        ans[i][j] = true;
        ans[j][i] = true;
      }
    }
  }
  for (int i = 0; i < 1001; ++i)
    for (int j = 0; j < col[i].size(); ++j) row[col[i][j]].insert(i);
  for (int i = 1; i < 101; ++i)
    if (row[i].size() == 0) {
      for (int j = 0; j < 1001; ++j)
        if (col[j].size() == 0) {
          col[j].push_back(i);
          row[i].insert(j);
          break;
        }
    }
  for (int i = 1; i <= n; ++i) {
    printf("%d\n", row[i].size());
    for (set<int>::iterator it = row[i].begin(); it != row[i].end(); ++it)
      printf("%d %d\n", i, (*it) + 1);
  }
}
