#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const long long maxn = 1e6 + 10;
vector<long long> g[maxn];
int32_t main() {
  long long n = in();
  cout << n - 1 << "\n";
  for (long long i = 0; i < n - 1; i++) {
    long long v = in() - 1, u = in() - 1;
    cout << 2 << " " << v + 1 << " " << u + 1 << "\n";
    g[v].push_back(i);
    g[u].push_back(i);
  }
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j + 1 < g[i].size(); j++)
      cout << g[i][j] + 1 << " " << g[i][j + 1] + 1 << "\n";
}
