#include <iostream>

using namespace std;


template<int...Ts>
struct Cart
{
  template<int...Us>
  static void go() { }
};


template<int H1, int...Ts>
struct Cart<H1, Ts...>
{
  template<int...Us>
  static void go()
  {
    X<Us...>::go();
    Cart<Ts...>::template go<Us...>();
  }

  template<int...Us>
  struct X
  {
    static void go() { }
  };
  template<int H2, int...Us>
  struct X<H2, Us...>
  {
    static void go()
    {
      cout<<H1<<":"<<H2<<endl;
      X<Us...>::go();
    }
  };
};

template<int...Ts>
void expand(void)
{
  Cart<Ts...>::template go<Ts...>();
}


int main(void)
{
  expand<>();
  cout<<"---\n";
  expand<1>();
  cout<<"---\n";
  expand<1,2,66>();
  cout<<"---\n";
  expand<1,2,66,42,1>();
  return 0;
}
