#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:67108864")
using namespace std;
const int MAXN = 100000;
int root = -1;
int vertex = 1;
vector<int> g[MAXN];
vector<pair<int, int> > edges;
int deg[MAXN];
void dfs(int v, int p, int curv) {
  if (v != root) {
    for (int i = 0; i < g[v].size(); i++) {
      int to = g[v][i];
      if (to != p) {
        vertex++;
        cout << 2 << " " << v + 1 << " " << to + 1 << endl;
        edges.push_back(make_pair(curv, vertex));
        dfs(to, v, vertex);
      }
    }
  } else {
    for (int i = 0; i < g[v].size(); i++) {
      int to = g[v][i];
      if (to != p) {
        cout << 2 << " " << v + 1 << " " << to + 1 << endl;
        dfs(to, v, vertex);
      }
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int v1, v2;
    cin >> v1 >> v2;
    v1--;
    v2--;
    g[v1].push_back(v2);
    g[v2].push_back(v1);
    deg[v1]++;
    deg[v2]++;
  }
  for (int i = 0; i < n; i++) {
    if (deg[i] == 1) {
      root = i;
      break;
    }
  }
  cout << n - 1 << endl;
  dfs(root, -1, 1);
  for (int i = 0; i < edges.size(); i++) {
    cout << edges[i].first << " " << edges[i].second << endl;
  }
  return 0;
}
