#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> e[100010];
vector<int> t[100010];
bool vis[100010];
int depth[100010];
vector<pair<int, int> > nodes;
int k;
map<pair<int, int>, int> m;
void dfs(int p) {
  vis[p] = 1;
  vector<pair<int, int> > v;
  for (__typeof((e[p]).begin()) it = (e[p]).begin(); it != (e[p]).end(); it++)
    if (!vis[*it]) {
      int temp = k;
      nodes.push_back(make_pair(p, *it));
      m[make_pair(p, *it)] = k++;
      v.push_back(make_pair(p, *it));
      dfs(*it);
      if (k > temp + 1) t[temp].push_back(temp + 1);
    }
  for (int i = 0; i < (int)v.size() - 1; i++) t[m[v[i]]].push_back(m[v[i + 1]]);
  return;
}
int main() {
  cin >> n;
  int a, b;
  for (int i = 0; i < (int)n - 1; i++) {
    scanf("%d%d", &a, &b);
    a--;
    b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  k = 0;
  dfs(0);
  cout << k << endl;
  for (int i = 0; i < (int)nodes.size(); i++)
    cout << 2 << " " << nodes[i].first + 1 << " " << nodes[i].second + 1
         << endl;
  for (int i = 0; i < (int)k; i++)
    for (int j = 0; j < (int)t[i].size(); j++)
      cout << i + 1 << " " << t[i][j] + 1 << endl;
  return 0;
}
