#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
const int INF = 1 << 29;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int& n, int b) { n |= two(b); }
inline void unset_bit(int& n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) {
  int res = 0;
  while (n && ++res) n -= n & (-n);
  return res;
}
template <class T>
void chmax(T& a, const T& b) {
  a = max(a, b);
}
template <class T>
void chmin(T& a, const T& b) {
  a = min(a, b);
}
const int MAX = 100007;
int N;
vector<int> graph[MAX];
vector<pair<int, int> > nodes;
vector<pair<int, int> > edges;
void go(int node, int parent, int p) {
  for (int i = 0; i < (graph[node].size()); i++) {
    int next = graph[node][i];
    if (next == parent) continue;
    int index = nodes.size();
    nodes.push_back(make_pair(node, next));
    if (p != -1)
      edges.push_back(make_pair(p, index));
    else
      p = index;
    go(next, node, index);
  }
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < (N - 1); i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  go(0, -1, -1);
  printf("%d\n", nodes.size());
  for (int i = 0; i < (nodes.size()); i++)
    printf("2 %d %d\n", nodes[i].first + 1, nodes[i].second + 1);
  for (int i = 0; i < (edges.size()); i++)
    printf("%d %d\n", edges[i].first + 1, edges[i].second + 1);
  return 0;
}
