#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int from[maxn], to[maxn];
vector<int> adj[maxn];
vector<int> g[maxn];
void ad_e(int u, int v) {
  g[u].push_back(v);
  g[v].push_back(u);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    from[i] = u, to[i] = v;
    adj[u].push_back(i);
    adj[v].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < adj[i].size(); j++) ad_e(adj[i][0], adj[i][j]);
  }
  cout << n - 1 << '\n';
  for (int i = 0; i < n - 1; i++)
    cout << "2 " << from[i] + 1 << " " << to[i] + 1 << '\n';
  for (int i = 0; i < n; i++) {
    for (int j : g[i])
      if (j < i) cout << j + 1 << " " << i + 1 << '\n';
  }
}
