struct item {
int value;
item* parent;
vector<item*> children;
item(int v, item* p = nullptr) : value(v), parent(p) {}
void addChild(int value) {
children.push_back(new item(value, this));
}
~item() {
for(auto child : children)
delete *child;
}
}