#include <bits/stdc++.h>
const double EPS = 1e-9;
const int INT_INF = 2 * (int)1e9;
const long long I64_INF = (long long)1e18;
const double PI = acos(-1.0);
using namespace std;
vector<pair<int, int> > g[100500];
int n;
vector<pair<int, int> > e;
int V[100500][2];
void dfs(int v, int p = -1, int num = -1) {
  if (v > 0) V[num][0] = p, V[num][1] = v;
  int prev = -1;
  for (int i = 0; i < (int)g[v].size(); i++) {
    int to = g[v][i].first;
    if (to == p) continue;
    if (v > 0 && prev == -1) e.push_back(make_pair(num, g[v][i].second));
    if (prev != -1) e.push_back(make_pair(g[v][prev].second, g[v][i].second));
    prev = i;
    dfs(to, v, g[v][i].second);
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < (int)n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    g[a].push_back(make_pair(b, i));
    g[b].push_back(make_pair(a, i));
  }
  dfs(0);
  printf("%d\n", n - 1);
  for (int i = 0; i < (int)n - 1; i++) {
    printf("2 ");
    for (int j = 0; j < (int)2; j++) printf("%d ", V[i][j] + 1);
    puts("");
  }
  for (int i = 0; i < (int)e.size(); i++)
    printf("%d %d\n", e[i].first + 1, e[i].second + 1);
  return 0;
}
