#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 100100;
inline int read() {
  int res, ok = 1;
  char ch;
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') ok = -1;
  res = ch - '0';
  for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
    res = res * 10 + ch - '0';
  return res * ok;
}
vector<int> g[N];
int f[N], idx;
void dfs(int u, int fa, int pre) {
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == fa) continue;
    printf("2 %d %d\n", u, v);
    ++idx;
    if (pre) {
      f[idx] = pre;
    }
    pre = idx;
    dfs(v, u, idx);
  }
}
int main() {
  int n;
  n = read();
  for (int i = 1; i < n; i++) {
    int x, y;
    x = read();
    y = read();
    g[x].push_back(y);
    g[y].push_back(x);
  }
  printf("%d\n", n - 1);
  dfs(1, 0, 0);
  for (int i = 2; i <= n - 1; i++) {
    printf("%d %d\n", f[i], i);
  }
  return 0;
}
