#include <iostream>
#include <vector>
#include <string>
using std::cout;
template< typename T >
struct tree_node
{
T t;
std::vector<tree_node> children;
void walk_depth_first() const;
};
template< typename T >
void tree_node<T>::walk_depth_first() const
{
cout<<t<<"\n";;
for ( auto & n: children ) n.walk_depth_first();
}
int main()
{
tree_node<std::string> tree;
tree.t="base";
tree.children.push_back({"a"});
tree.children.push_back({"b"});
tree.children.push_back({"c"});
tree.children.at(1).children.push_back({"ba"});
tree.walk_depth_first();
}
CiAgICNpbmNsdWRlIDxpb3N0cmVhbT4KICAgI2luY2x1ZGUgPHZlY3Rvcj4KICAgI2luY2x1ZGUgPHN0cmluZz4KCiAgIHVzaW5nIHN0ZDo6Y291dDsKCnRlbXBsYXRlPCB0eXBlbmFtZSBUID4Kc3RydWN0IHRyZWVfbm9kZQogICB7CiAgIFQgdDsKICAgc3RkOjp2ZWN0b3I8dHJlZV9ub2RlPiBjaGlsZHJlbjsKICAgdm9pZCB3YWxrX2RlcHRoX2ZpcnN0KCkgY29uc3Q7CiAgIH07Cgp0ZW1wbGF0ZTwgdHlwZW5hbWUgVCA+CnZvaWQgdHJlZV9ub2RlPFQ+Ojp3YWxrX2RlcHRoX2ZpcnN0KCkgY29uc3QKICAgewogICBjb3V0PDx0PDwiXG4iOzsKICAgZm9yICggYXV0byAmIG46IGNoaWxkcmVuICkgbi53YWxrX2RlcHRoX2ZpcnN0KCk7CiAgIH0KCmludCBtYWluKCkKICAgewogICB0cmVlX25vZGU8c3RkOjpzdHJpbmc+IHRyZWU7CiAgIHRyZWUudD0iYmFzZSI7CiAgIHRyZWUuY2hpbGRyZW4ucHVzaF9iYWNrKHsiYSJ9KTsKICAgdHJlZS5jaGlsZHJlbi5wdXNoX2JhY2soeyJiIn0pOwogICB0cmVlLmNoaWxkcmVuLnB1c2hfYmFjayh7ImMifSk7CiAgIHRyZWUuY2hpbGRyZW4uYXQoMSkuY2hpbGRyZW4ucHVzaF9iYWNrKHsiYmEifSk7CiAgIHRyZWUud2Fsa19kZXB0aF9maXJzdCgpOwogICB9Cg==