#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 30) - 1;
const long double EPS = 1e-9;
const long double PI = fabs(atan2(0.0, -1.0));
const int MAXN = 100005;
int n;
vector<int> g[MAXN];
void load() {
  scanf("%d", &n);
  for (int i = 0, a, b; i < n - 1; i++) {
    scanf("%d%d", &a, &b);
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
}
int par[MAXN];
void dfs(int v, int p) {
  par[v] = p;
  for (int i = 0; i < (int)g[v].size(); i++) {
    int to = g[v][i];
    if (to == p) continue;
    dfs(to, v);
  }
}
vector<int> dcs[MAXN];
vector<pair<int, int> > dc;
void solve() {
  dfs(0, -1);
  for (int i = 1; i < n; i++) {
    dcs[par[i]].push_back(dc.size());
    dcs[i].push_back(dc.size());
    dc.push_back(make_pair(par[i], i));
  }
  printf("%d\n", dc.size());
  for (int i = 0; i < (int)dc.size(); i++)
    printf("2 %d %d\n", dc[i].first + 1, dc[i].second + 1);
  for (int i = 0; i < n; i++) {
    sort(dcs[i].begin(), dcs[i].end());
    dcs[i].erase(unique(dcs[i].begin(), dcs[i].end()), dcs[i].end());
    for (int j = 1; j < (int)dcs[i].size(); j++)
      printf("%d %d\n", dcs[i][j - 1] + 1, dcs[i][j] + 1);
  }
}
int main() {
  load();
  solve();
  return 0;
}
