#include <bits/stdc++.h>
using namespace std;
int N, M, i, j, s, t;
vector<vector<int> > AdjList;
bool vis[1000000];
map<pair<int, int>, int> hm;
void dfs(int u) {
  vis[u] = true;
  if (AdjList[u].size() >= 2) {
    int t1 = AdjList[u][0];
    for (int k = 1; k < AdjList[u].size(); k++) {
      int t2 = AdjList[u][k];
      printf("%d %d\n", hm[pair<int, int>(u, t1)], hm[pair<int, int>(u, t2)]);
    }
  }
  for (int j = 0; j < AdjList[u].size(); j++) {
    int v = AdjList[u][j];
    if (!vis[v]) dfs(v);
  }
}
int main() {
  cin >> N;
  M = N - 1;
  AdjList.assign(N, vector<int>());
  memset(vis, false, sizeof(vis));
  cout << M << endl;
  for (int i = 0; i < M; i++) {
    cin >> s >> t;
    AdjList[s - 1].push_back(t - 1);
    AdjList[t - 1].push_back(s - 1);
    printf("2 %d %d\n", s, t);
    hm[pair<int, int>(s - 1, t - 1)] = i + 1;
    hm[pair<int, int>(t - 1, s - 1)] = i + 1;
  }
  dfs(0);
}
