#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int mod = 1000000007;
const int INF = 1000000000;
const int N = 100005;
using namespace std;
int n;
vector<int> mas[N];
int main() {
  ios ::sync_with_stdio(0);
  cin >> n;
  int a, b;
  cout << n - 1 << endl;
  for (int i = 1; i < n; ++i) {
    cin >> a >> b;
    mas[a].push_back(i);
    mas[b].push_back(i);
    cout << 2 << " " << a << " " << b << endl;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < mas[i].size() - 1; ++j) {
      cout << mas[i][j] << " " << mas[i][j + 1] << endl;
    }
  }
  return 0;
}
