#include <bits/stdc++.h>
using namespace std;
const long long maxn = 100010;
vector<pair<int, int> > adj[maxn], v;
bool mark[maxn];
int p[maxn];
void dfs(int x, int par) {
  mark[par] = true;
  for (register int i = (0); i < (int)(adj[x].size()); ++i) {
    pair<int, int> next = adj[x][i];
    if (!mark[next.second]) {
      p[next.second] = par;
      dfs(next.first, next.second);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  fill(p, p + maxn, -1);
  int n;
  cin >> n;
  for (register int i = (0); i < (int)(n - 1); ++i) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    v.push_back(make_pair(x, y));
    adj[x].push_back(make_pair(y, i));
    adj[y].push_back(make_pair(x, i));
  }
  mark[0] = true;
  dfs(v[0].first, 0);
  dfs(v[0].second, 0);
  cout << n - 1 << endl;
  for (register int i = (0); i < (int)(n - 1); ++i)
    cout << 2 << ' ' << v[i].first + 1 << ' ' << v[i].second + 1 << endl;
  for (register int i = (0); i < (int)(n - 1); ++i)
    if (p[i] != -1) cout << i + 1 << ' ' << p[i] + 1 << endl;
  return 0;
}
