#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double PI = acos(-1.0);
const int INF = 1e9 + 7;
const int N = int(2e5 + 7);
int n, xf, yf;
pair<int, int> v[N];
vector<pair<int, int> > g[N], edges;
void dfs(int v, int p, int ver) {
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (to == p) continue;
    edges.push_back(make_pair(ver, g[v][i].second));
    dfs(to, v, g[v][i].second);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  cout << n - 1 << endl;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    if (i == 1) xf = x, yf = y;
    cout << 2 << " " << x << " " << y << endl;
    g[x].push_back(make_pair(y, i));
    g[y].push_back(make_pair(x, i));
  }
  dfs(xf, yf, 1);
  dfs(yf, xf, 1);
  for (auto edge : edges) cout << edge.first << " " << edge.second << endl;
  return 0;
}
