#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5;
int n, p[N];
vector<int> s, g[N];
vector<pair<int, int> > v, ans;
bool used[N];
void topsort(int v, int p) {
  for (int i = 0; i < (int)(g[v]).size(); i++) {
    int next = g[v][i];
    if (next != p) topsort(next, v);
  }
  s.push_back(v);
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    g[a - 1].push_back(b - 1);
    g[b - 1].push_back(a - 1);
  }
  topsort(0, -1);
  reverse(s.begin(), s.end());
  memset(p, -1, sizeof(p));
  for (int i = 0; i < n; i++) {
    int cur = s[i];
    for (int j = 0; j < (int)(g[cur]).size(); j++) {
      int next = g[cur][j];
      if (!used[next]) {
        v.push_back(make_pair(cur, next));
        p[next] = (int)(v).size() - 1;
        if (p[cur] != -1)
          ans.push_back(make_pair(p[cur], p[next]));
        else if ((int)(v).size() > 1)
          ans.push_back(make_pair((int)(v).size() - 2, (int)(v).size() - 1));
      }
    }
    used[cur] = true;
  }
  printf("%d\n", (int)(v).size());
  for (int i = 0; i < (int)(v).size(); i++) {
    printf("2 %d %d\n", v[i].first + 1, v[i].second + 1);
  }
  for (int i = 0; i < (int)(ans).size(); i++) {
    printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
  }
  return 0;
}
