#include <bits/stdc++.h>
long double eps = 1e-12;
using namespace std;
const char al[100] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
                      'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
                      'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
vector<vector<int> > my;
vector<pair<int, int> > ans;
vector<vector<int> > cont(1000000);
int n;
vector<int> used;
vector<int> temp;
int num = 1;
void dfs(int id, int cur) {
  used[id] = 1;
  int to;
  int pre = cur;
  for (int i = 0; i < my[id].size(); i++) {
    to = my[id][i];
    if (used[to] == 0) {
      cont[num].push_back(id);
      cont[num].push_back(to);
      ans.push_back(make_pair(pre, num));
      pre = num;
      num++;
      dfs(to, num - 1);
    }
  }
}
int main() {
  cin >> n;
  int x, y;
  my.resize(n + 1);
  used.resize(n + 1, 0);
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    my[x].push_back(y);
    my[y].push_back(x);
  }
  dfs(1, 0);
  cout << num - 1 << endl;
  for (int i = 1; i < num; i++) {
    cout << "2 " << cont[i][0] << " " << cont[i][1] << endl;
  }
  for (int i = 0; i < ans.size(); i++) {
    if (ans[i].first != 0) {
      cout << ans[i].first << " " << ans[i].second << endl;
    }
  }
}
