#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("tune=native")
using namespace std;
const int MAX = 1e5 + 5;
const long long MOD = 1000000007;
const long long MOD2 = 2010405347;
const long long INF = 2e18;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1, 0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 600;
int n, a, b, id;
vector<int> v[MAX];
vector<pair<int, int> > ans;
void dfs(int nw, int par, int num) {
  if (par) cout << "2 " << nw << ' ' << par << '\n';
  for (int i : v[nw])
    if (i != par) {
      ans.push_back({num, ++id});
      dfs(i, nw, id);
    }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  cout << n - 1 << '\n';
  a = 1, b = v[1].back();
  cout << "2 " << a << ' ' << b << '\n';
  sort(v[b].begin(), v[b].end());
  reverse(v[b].begin(), v[b].end());
  v[a].pop_back(), v[b].pop_back();
  id = 1;
  dfs(a, 0, 1);
  dfs(b, 0, 1);
  for (pair<int, int> i : ans) cout << i.first << ' ' << i.second << '\n';
  return 0;
}
