#include <bits/stdc++.h>
using namespace std;
int curr = 0;
int parent[100001];
vector<int> adj[100001], adj2[100001];
bool visited[100001], visited2[100001];
map<pair<int, int>, int> nodes;
void dfs(int u) {
  visited[u] = true;
  int edgenum = nodes[make_pair(parent[u], u)];
  for (int i = 0; i < adj[u].size(); i++) {
    if (!visited[adj[u][i]]) {
      parent[adj[u][i]] = u;
      curr++;
      nodes[make_pair(u, adj[u][i])] = curr;
      adj2[edgenum].push_back(curr);
      adj2[curr].push_back(edgenum);
      printf("2 %d %d\n", u, adj[u][i]);
      dfs(adj[u][i]);
    }
  }
}
void dfs2(int u) {
  visited2[u] = true;
  for (int i = 0; i < adj2[u].size(); i++) {
    if (!visited2[adj2[u][i]]) {
      printf("%d %d\n", u + 1, adj2[u][i] + 1);
      dfs2(adj2[u][i]);
    }
  }
}
int main() {
  int n;
  scanf(" %d", &n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf(" %d %d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  int s;
  for (int i = 1; i <= n; i++) {
    if (adj[i].size() == 1) s = i;
  }
  visited[s] = true;
  nodes[make_pair(s, adj[s][0])] = 0;
  parent[adj[s][0]] = s;
  printf("%d\n", n - 1);
  printf("2 %d %d\n", s, adj[s][0]);
  dfs(adj[s][0]);
  dfs2(0);
  return 0;
}
