#include <bits/stdc++.h>
using namespace std;
int a[5010][5010];
int ans[50000];
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int l, r;
    cin >> l >> r;
    a[l][i] = r;
    a[r][i] = l;
    ans[l]++;
    ans[r]++;
  }
  int kol = m + 1;
  for (int i = 1; i <= n; i++)
    if (ans[i] != 0) {
      cout << ans[i] << endl;
      for (int j = 1; j <= m; j++)
        if (i == a[a[i][j]][j]) cout << i << ' ' << j << endl;
    } else {
      cout << 1 << endl;
      cout << i << ' ' << kol << endl;
      kol++;
    }
}
