#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> g[100500];
int u[100500];
map<pair<int, int>, int> m;
vector<int> g1[100500];
void dfs(int v, int v1, int t1) {
  u[v] = 1;
  for (int i = 0; i < int(g[v].size()); ++i) {
    if (!u[g[v][i]]) {
      int t = g[v][i];
      int tmp = m[make_pair(v, t)];
      if (t1 > 0) {
        g1[t1].push_back(tmp);
        g1[tmp].push_back(t1);
      }
      dfs(t, v, tmp);
    }
  }
}
int main() {
  int i, a, b;
  cin >> n;
  cout << n - 1 << endl;
  for (i = 0; i < n - 1; ++i) {
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
    m[make_pair(a, b)] = i + 1;
    m[make_pair(b, a)] = i + 1;
    cout << "2 " << a << " " << b << endl;
  }
  memset(u, 0, sizeof(u));
  for (i = 1; i <= n; ++i)
    if (g[i].size() == 1) break;
  dfs(i, -1, -1);
  for (i = 1; i < n; ++i)
    for (int j = 0; j < (int)g1[i].size(); ++j)
      if (i < g1[i][j]) cout << i << " " << g1[i][j] << endl;
  return 0;
}
int cpp4cf_main() {
  freopen("A.cpp", "r", stdin);
  char s[99];
  bool f;
  while (true) {
    cin >> s;
    if (cin.eof()) break;
    if (strstr(s, "/*")) {
      cin >> s;
      if (strstr(s, "Test")) {
        cin >> s;
        if (strstr(s, "on")) {
          cout << "Output: ";
          cpp4cf_main();
          cout << "\nAnswer: ";
          f = false;
          while (true) {
            cin >> s;
            if (strstr(s, "*/")) break;
            if (strstr(s, "//")) {
              if (f)
                cout << endl;
              else
                f = true;
            } else
              cout << s << " ";
          }
          cout << "\n\n";
        }
      }
    }
  }
  return 0;
}
