#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> g[N], w[N], newg[N], xx, yy;
void dfs(int v, int p) {
  int prev = -1;
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (to != p) {
      if (g[to].size() > 1)
        newg[w[v][i]].push_back((w[to][0] == w[v][i] ? w[to][1] : w[to][0]));
      dfs(to, v);
      if (prev != -1) newg[prev].push_back(w[v][i]);
      prev = w[v][i];
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x, --y;
    xx.push_back(x);
    yy.push_back(y);
    g[x].push_back(y);
    g[y].push_back(x);
    w[x].push_back(i);
    w[y].push_back(i);
  }
  dfs(0, -1);
  cout << n - 1 << endl;
  for (int i = 0; i < n - 1; ++i) printf("2 %d %d\n", xx[i] + 1, yy[i] + 1);
  for (int i = 0; i < n - 1; ++i)
    for (int j = 0; j < newg[i].size(); ++j)
      printf("%d %d\n", i + 1, newg[i][j] + 1);
  return 0;
}
