#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100001];
vector<pair<long long, long long> > ans[100000];
bool visit[100001];
const int mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, a, b, i;
  cin >> n >> m;
  for (long long i = 0; i < m; i += 1) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (long long j = 1; j <= n; j += 1) ans[j].push_back({j, j});
  int row = n + 1;
  for (long long j = 1; j <= n; j += 1) {
    for (long long i = 0; i < adj[j].size(); i += 1) {
      if (adj[j][i] > j) {
        ans[j].push_back({row, j});
        ans[adj[j][i]].push_back({row, adj[j][i]});
        row++;
      }
    }
  }
  for (long long j = 1; j <= n; j += 1) {
    cout << ans[j].size() << endl;
    for (long long i = 0; i < ans[j].size(); i += 1) {
      cout << ans[j][i].first << " " << ans[j][i].second << endl;
    }
  }
  return 0;
}
