#include <bits/stdc++.h>
namespace solution {
class SolutionInterface {
 public:
  virtual int run() = 0;

 protected:
  virtual void pre_calc() {}
  virtual bool action() = 0;
  virtual void init(){};
  virtual bool input() { return false; };
  virtual void output(){};
  SolutionInterface() {}

 private:
};
}  // namespace solution
namespace solution {
class SolutionBase : public SolutionInterface {
 public:
  virtual int run() {
    pre_calc();
    while (action())
      ;
    return 0;
  }
};
}  // namespace solution
namespace solution {}
namespace solution {
using namespace std;
}
namespace solution {
const int SIZE = 100000 + 11;
const int NONE = -1;
const int INF = std::numeric_limits<int>::max();
int n;
int A[SIZE];
int B[SIZE];
std::vector<int> G[SIZE];
int U[SIZE];
int V[SIZE];
int edges_num;
set<std::pair<int, int> > used;
bool visited[SIZE];
int group_id[SIZE];
}  // namespace solution
namespace solution {
class Solver {
 public:
  void solve() {
    normalize();
    generate_graph();
  }
  void normalize() {
    for (int i = 0; i < n - 1; ++i) {
      A[i]--;
      B[i]--;
    }
    for (int i = 0; i < n - 1; ++i) {
      int a = A[i];
      int b = B[i];
      G[a].push_back(i);
      G[b].push_back(i);
    }
  }
  void generate_graph() {
    for (int i = 0; i < n; ++i) {
      int num = G[i].size();
      for (int j = 0; j + 1 < num; ++j) {
        U[edges_num] = G[i][j];
        V[edges_num] = G[i][j + 1];
        edges_num++;
      }
    }
  }
  int get_group_id(int vertex) { return group_id[vertex]; }

 private:
};
}  // namespace solution
namespace solution {
class Solution : public SolutionBase {
 public:
 protected:
  virtual bool action() {
    init();
    if (!input()) return false;
    solver.solve();
    output();
    return true;
  }
  void init() {
    edges_num = 0;
    for (int i = 0; i < SIZE; ++i) {
      U[i] = NONE;
      V[i] = NONE;
    }
    for (int i = 0; i < SIZE; ++i) {
      G[i].clear();
    }
    fill(group_id, group_id + SIZE, INF);
    used.clear();
  }
  bool input() {
    if (!(cin >> n)) return false;
    for (int i = 0; i < n - 1; ++i) cin >> A[i] >> B[i];
    return true;
  }
  void output() {
    cout << n - 1 << endl;
    for (int i = 0; i < n - 1; ++i) {
      cout << 2 << " " << A[i] + 1 << " " << B[i] + 1 << endl;
    }
    for (int i = 0; i < n - 2; ++i) {
      cout << U[i] + 1 << " " << V[i] + 1 << endl;
    }
  }

 private:
  Solver solver;
};
}  // namespace solution
int main() { return solution::Solution().run(); }
