#include <bits/stdc++.h>
using namespace std;
const int maxn = 100500;
int n;
vector<int> g[maxn];
vector<int> s[maxn];
vector<pair<int, int> > e;
void dfs(int v, int p) {
  if (p != -1) {
    s[v].push_back(p);
  }
  s[v].push_back(v);
  int prv = -1;
  for (size_t i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (to == p) continue;
    if (p != -1)
      e.push_back(make_pair(v, to));
    else {
      if (prv != -1) e.push_back(make_pair(prv, to));
      prv = to;
    }
    dfs(to, v);
  }
}
int main() {
  srand(time(0));
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(1, -1);
  cout << n - 1 << "\n";
  for (int i = 2; i <= n; i++) {
    cout << s[i].size();
    for (size_t j = 0; j < s[i].size(); j++) cout << " " << s[i][j];
    cout << "\n";
  }
  for (size_t i = 0; i < e.size(); i++)
    cout << e[i].first - 1 << " " << e[i].second - 1 << "\n";
  return 0;
}
