#include <iostream>
#include <vector>
#include <map>

typedef std::vector<uint> PathType;
typedef std::map<uint,bool> VisType;
typedef std::map<uint,std::vector<uint>> RelType;

void PrintPath(uint I, PathType P, VisType V, RelType R) {
  if (V.find(I) != V.end()) return;
  P.push_back(I); V[I]=true;
  for(const auto& x: P) std::cout << ":" << x; std::cout << std::endl;
  for(const auto& i: R[I]) PrintPath(i,P,V,R);
}

int main() {
  VisType Vis;
  PathType Path;
  RelType Rel = {
    {0,{1,5,6}},
    {1,{0,2,6}},
    {2,{1,3,6}},
    {3,{2,4,6}},
    {4,{3,5,6}},
    {5,{0,4,6}},
    {6,{0,1,2,3,4,5}}
  };
  for(auto const& i:Rel) PrintPath(i.first,Path,Vis,Rel);
}
