#include <bits/stdc++.h>
using namespace std;
const int MAX = int(1e5) + 100;
int N;
int counter;
vector<int> adj[MAX];
vector<int> T[MAX];
vector<int> X[MAX];
void dfs(int v, int p = -1, int pedge = -1) {
  int before = -1;
  for (int i = 0; i < (int)adj[v].size(); i++) {
    int w = adj[v][i];
    if (w == p) continue;
    counter++;
    X[counter].push_back(v), X[counter].push_back(w);
    if (before == -1) {
      if (pedge != -1) T[counter].push_back(pedge);
      before = counter;
    } else {
      T[counter].push_back(before);
    }
    dfs(w, v, counter);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> N;
  for (int i = 1; i < N; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1);
  cout << N - 1 << endl;
  for (int i = 1; i <= counter; i++)
    cout << "2 " << X[i][0] << " " << X[i][1] << endl;
  for (int i = 1; i <= counter; i++)
    if (T[i].size()) {
      for (int j = 0; j < (int)T[i].size(); i++)
        cout << i << " " << T[i][j] << endl;
    }
  return 0;
}
