#include <bits/stdc++.h>
using namespace std;
const long long int M = 1000000007;
long long int arr[1000006];
char str[1000006];
vector<int> adj[100005];
int visited[100005];
vector<pair<int, int>> nodes;
vector<int> nodes_adj[100005];
void dfs(int n, int pre) {
  visited[n] = true;
  for (auto i : adj[n])
    if (!visited[i]) {
      nodes.push_back({n, i});
      nodes_adj[pre].push_back(nodes.size());
      dfs(i, nodes.size());
    }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t, n, k, m, ans, x, y;
  t = 1;
  while (t--) {
    cin >> n;
    bool flag = true;
    for (int i = 1; i < n; i++) {
      cin >> x >> y;
      adj[x].push_back(y);
      adj[y].push_back(x);
    }
    dfs(1, 0);
    cout << nodes.size() << '\n';
    for (auto i : nodes) cout << 2 << ' ' << i.first << ' ' << i.second << '\n';
    for (auto j : nodes_adj[0])
      if (j != 1) cout << 1 << ' ' << j << '\n';
    for (int i = 1; i < nodes.size(); i++)
      for (auto j : nodes_adj[i]) cout << i << ' ' << j << '\n';
  }
  return 0;
}
