#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int> > ribs;
  int n;
  cin >> n;
  vector<vector<int> > v(n);
  for (int i = 0; i < (n - 1); ++i) {
    int a, b;
    cin >> a >> b;
    ribs.push_back((make_pair(min(a, b), max(a, b))));
  }
  sort(ribs.begin(), ribs.end());
  for (int i = 0; i < (n - 1); ++i) {
    v[ribs[i].first - 1].push_back((i));
    v[ribs[i].second - 1].push_back((i));
  }
  for (int i = 0; i < (n - 1); ++i) {
    sort(v[i].begin(), v[i].end());
  }
  cout << n - 1 << endl;
  for (int i = 0; i < (n - 1); ++i) {
    cout << 2 << " " << ribs[i].first << " " << ribs[i].second << "\n";
  }
  vector<char> used(n, 0);
  for (int i = 0; i < (n - 1); ++i) {
    int a = ribs[i].first - 1;
    int b = ribs[i].second - 1;
    if (!used[a]) {
      int j = upper_bound(v[a].begin(), v[a].end(), i) - v[a].begin();
      while (j < (int)(v[a]).size()) {
        cout << i + 1 << " " << v[a][j] + 1 << endl;
        used[a] = 1;
        ++j;
      }
    }
    if (!used[b]) {
      int j = upper_bound(v[b].begin(), v[b].end(), i) - v[b].begin();
      while (j < (int)(v[b]).size()) {
        used[b] = 1;
        cout << i + 1 << " " << v[b][j] + 1 << endl;
        ++j;
      }
    }
  }
  return 0;
}
