#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100009];
int parent[100009];
void dfs(int i, int p = 0) {
  for (int x : adj[i])
    if (x != p) {
      dfs(x, i);
      parent[x] = i;
    }
}
int main() {
  int n, a, b;
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  parent[1] = 0;
  dfs(1);
  cout << n - 1 << "\n";
  for (int i = 2; i <= n; i++) {
    cout << 2 << " " << i << " " << parent[i] << "\n";
  }
  for (int i = 2; i <= n; i++) {
    for (int x : adj[i]) {
      if (x > i) {
        cout << i - 1 << " " << x - 1 << "\n";
      }
    }
  }
  for (int i = 1; i < adj[1].size(); i++)
    cout << adj[1][i] - 1 << " " << adj[1][0] - 1 << "\n";
}
