#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
vector<vector<int> > adj(maxn), adj2(maxn);
vector<pair<int, int> > vs;
bool vis[maxn];
void dfs(int pv, int v) {
  vis[v] = 1;
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i];
    if (vis[u]) continue;
    vs.push_back(make_pair(v, u));
    adj2[pv].push_back(vs.size() - 1);
    dfs(vs.size() - 1, u);
  }
}
int main() {
  int n, a, b;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  memset(vis, 0, maxn);
  vs.push_back(make_pair(-1, -1));
  int s;
  for (int i = 1; i <= n; i++)
    if (adj[i].size() == 1) {
      s = i;
      break;
    }
  vis[s] = 1;
  for (int i = 0; i < adj[s].size(); i++) {
    int u = adj[s][i];
    vs.push_back(make_pair(s, u));
    dfs(vs.size() - 1, u);
  }
  cout << n - 1 << endl;
  for (int i = 1; i <= n - 1; i++) {
    cout << "2 " << vs[i].first << " " << vs[i].second << endl;
  }
  for (int i = 1; i <= n - 1; i++) {
    for (int j = 0; j < adj2[i].size(); j++)
      cout << i << " " << adj2[i][j] << endl;
  }
  return 0;
}
