#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << '\n';
  err(++it, args...);
}
const long long mod = 1e9 + 7;
vector<pair<int, int>> adj[100005], ans;
void dfs(int v, int p, int val) {
  for (auto &u : adj[v]) {
    if (u.first != p) {
      if (u.second != val) ans.push_back({val, u.second});
      dfs(u.first, v, u.second);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  cout << n - 1 << '\n';
  for (__typeof(n) i = (1) - (1 > n); i != (n) - (1 > n);
       i += 1 - 2 * (1 > n)) {
    int x, y;
    cin >> x >> y;
    cout << 2 << ' ' << x << ' ' << y << '\n';
    adj[x].push_back({y, i});
    adj[y].push_back({x, i});
  }
  dfs(1, 1, adj[1][0].second);
  for (auto x : ans) cout << x.first << ' ' << x.second << '\n';
  return 0;
}
