#include <bits/stdc++.h>
using namespace std;
const int mn = 5010;
int num[mn];
int mp[mn][5010];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) mp[i][0] = i;
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    mp[a][++num[a]] = 100 * a + b;
    mp[b][++num[b]] = 100 * a + b;
  }
  for (int i = 1; i <= n; i++) {
    cout << num[i] + 1 << endl;
    for (int j = 0; j <= num[i]; j++) cout << i << ' ' << mp[i][j] << endl;
  }
  return 0;
}
