#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 50;
const int inf = 1e9;
vector<int> ans[105];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    int a, b;
    cin >> a >> b;
    ans[a].push_back(i);
    ans[b].push_back(i);
  }
  int cnt = 1;
  for (int i = 1; i <= n; ++i) {
    if (ans[i].size() == 0) {
      printf("1\n%d %d\n", i, m + cnt++);
    } else {
      printf("%d\n", ans[i].size());
      for (int j = 0; j < ans[i].size(); ++j) printf("%d %d\n", i, ans[i][j]);
    }
  }
  return 0;
}
