#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f;
const int N = 2e5 + 10;
const long long mod = 998244353;
struct node {
  int x, y, k;
} v[10000];
long long n, m, t, x, y, k, sum, cnt;
int r, c;
int vis[N], num[N];
int mp[1000][1000];
vector<pair<int, int> > ans[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) mp[i][i] = 1;
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    mp[x][y] = mp[y][x] = 1;
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    ans[i].push_back(pair<int, int>(++cnt, i));
    for (int j = i + 1; j <= n; j++) {
      if (mp[i][j]) {
        ans[i].push_back(pair<int, int>(++cnt, i));
        ans[j].push_back(pair<int, int>(cnt, j));
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i].size() << endl;
    for (int j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j].first << " " << ans[i][j].second << endl;
    }
  }
}
