#include <memory>
#include <string>
#include <iostream>

using namespace std;

static size_t indent = 0;

struct Base
{
  int value;
  
  Base(int value) : value(value) { }
  ~Base() {
    cout << string(indent*2, ' ') << "base destructor for " << value << endl;
    --indent;
  }
};

struct Node : public Base
{
  std::unique_ptr<Node> next;
  
  Node(int value, Node* next) : Base(value), next(next) { }
  
  ~Node()
  {
    ++indent;
    cout << string(indent*2, ' ') << "started destruction of " << value << endl;
  }
};

int main()
{
  Node* node = new Node(0, nullptr);
  for (int i = 1; i <= 5; ++i)
    node = new Node(i, node);
  
  delete node;
  
  return 0;
}