#include <bits/stdc++.h>
using namespace std;
int cnt = 0;
const int N = 100500;
vector<int> g[N];
vector<pair<int, int> > nv;
vector<int> ne[N];
int n;
void dfs(int v, int p = -1) {
  int nc = cnt++;
  if (p != -1) {
    nv.push_back(make_pair(v, p));
    ne[v].push_back(nc);
    ne[p].push_back(nc);
  }
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (to == p) continue;
    dfs(to, v);
  }
}
bool solve() {
  if (scanf("%d", &n) != 1) return false;
  if (n == 1) {
    printf("1 1\n");
    return true;
  }
  for (int i = 0; i < n; i++) {
    g[i].clear();
    ne[i].clear();
  }
  nv.clear();
  for (int i = 0; i + 1 < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  cnt = -1;
  dfs(0);
  printf("%d\n", nv.size());
  for (int i = 0; i < nv.size(); i++) {
    printf("2 %d %d\n", nv[i].first + 1, nv[i].second + 1);
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < ne[i].size(); j++) {
      printf("%d %d\n", ne[i][0] + 1, ne[i][j] + 1);
      cnt++;
    }
  }
  assert(cnt + 1 == nv.size());
  return true;
}
int main() {
  while (solve()) cerr << endl;
  return 0;
}
