#include <bits/stdc++.h>
using namespace std;
int mat[10005][105];
void solve(int test) {
  int n, m;
  cin >> n >> m;
  for (int(i) = 0; (i) < m; (i)++) {
    int x, y;
    cin >> x >> y;
    mat[i][x] = x;
    mat[i][y] = y;
  }
  int x = 10005, y = 105;
  for (int j = 1; j <= n; j++) {
    int ans = 0;
    for (int i = 0; i < m; i++) ans += (mat[i][j] != 0);
    if (ans == 0) {
      cout << 1 << "\n";
      cout << x << " " << y << endl;
      x++, y++;
      continue;
    }
    cout << ans << "\n";
    for (int i = 0; i < m; i++) {
      if (mat[i][j] != 0) {
        cout << j << " " << i + 1 << "\n";
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int test = 1;
  for (int(i) = 0; (i) < test; (i)++) {
    solve(i + 1);
  }
  return 0;
}
