#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
vector<long long int> rch, vis(2 * 100005);
vector<pair<long long int, long long int> > ans(2 * 100005), edges;
vector<vector<long long int> > adj(2 * 100005);
long long n;
void dfs(long long st) {
  for (auto &&it : adj[st]) {
    if (vis[it] == 0) {
      vis[it] = 1;
      if (ans[st].second == -1) rch.push_back(it);
      ans[it] = make_pair(it, st);
      dfs(it);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    cin >> n;
    for (long long int i = 0; i < n - 1; i++) {
      long long u, v;
      cin >> u >> v;
      edges.push_back(make_pair(u, v));
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
    vis[1] = 1;
    ans[1] = make_pair(1, -1);
    dfs(1);
    cout << n - 1 << "\n";
    for (long long int i = 2; i < n + 1; i++) {
      cout << 2 << " " << ans[i].first << " " << ans[i].second << "\n";
    }
    for (long long int i = 0; i < n - 1; i++) {
      long long u = edges[i].first, v = edges[i].second;
      if (u == 1 || v == 1) continue;
      cout << u - 1 << " " << v - 1 << "\n";
    }
    for (long long int i = 1; i < (long long int)rch.size(); i++) {
      cout << rch[i] - 1 << " " << rch[i - 1] - 1 << "\n";
    }
  }
  return 0;
}
