#include <bits/stdc++.h>
using namespace std;
vector<long long int> E[100500];
vector<pair<long long int, long long int> > ans;
vector<pair<long long int, long long int> > edges;
long long int n;
void recur(long long int pos, long long int pr, long long int pr_num = -1) {
  long long int num = ((long long int)(ans).size());
  if (pr != -1) ans.push_back(make_pair(pos, pr));
  if (pr_num != -1) edges.push_back(make_pair(pr_num, num));
  for (long long int i = 0;
       i < ((long long int)(((long long int)(E[pos]).size()))); ++i)
    if (E[pos][i] != pr) recur(E[pos][i], pos, num);
}
int main() {
  cin >> n;
  for (long long int i = 0; i < ((long long int)(n - 1)); ++i) {
    long long int a, b;
    cin >> a >> b;
    E[a - 1].push_back(b - 1);
    E[b - 1].push_back(a - 1);
  }
  for (long long int i = 0; i < ((long long int)(n)); ++i)
    if (((long long int)(E[i]).size()) == 1) {
      recur(E[i][0], i);
      break;
    }
  cout << ((long long int)(ans).size()) << endl;
  for (long long int i = 0;
       i < ((long long int)(((long long int)(ans).size()))); ++i)
    cout << 2 << " " << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
  for (long long int i = 0;
       i < ((long long int)(((long long int)(edges).size()))); ++i)
    cout << edges[i].first + 1 << " " << edges[i].second + 1 << endl;
}
