#include <bits/stdc++.h>
using namespace std;
vector<int> g[200000];
map<pair<int, int>, int> mm;
void dfsc(int node, int p = -1) {
  vector<int> chld;
  for (int i = (0); i < (g[node].size()); i += 1) {
    int to = g[node][i];
    chld.push_back(to);
  }
  for (int i = (0); i < (chld.size() - 1); i += 1) {
    if (chld.size() == 0) return;
    int a = chld[i], b = chld[i + 1];
    cout << mm[make_pair(node, a)] << ' ' << mm[make_pair(node, b)] << endl;
  }
  for (int i = (0); i < (chld.size()); i += 1)
    if (chld[i] != p) dfsc(chld[i], node);
}
int main() {
  int n;
  cin >> n;
  cout << n - 1 << endl;
  for (int i = (1); i < (n); i += 1) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
    mm[make_pair(a, b)] = mm[make_pair(b, a)] = i;
    cout << 2 << ' ' << a << ' ' << b << endl;
  }
  dfsc(1);
  return 0;
}
