#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
vector<int> g[MAX];
vector<pair<int, int>> ans, edges;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    edges.push_back({u, v});
    g[u].push_back(i);
    g[v].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    int l = g[i].size();
    for (int j = 1; j < l; j++) {
      ans.push_back({g[i][j - 1] + 1, g[i][j] + 1});
    }
  }
  cout << n - 1 << "\n";
  for (auto e : edges) cout << "2 " << e.first << " " << e.second << "\n";
  for (auto p : ans) cout << p.first << " " << p.second << "\n";
  return 0;
}
