#include <iostream>
using namespace std;

template<typename T>
struct Node {
  Node() { cout << this << ": created w/ default" << endl; }

  Node(const T &value, Node<T> *next = nullptr)
    : value(value), next(next)
  {
    cout << this << ": created w/ value" << endl;
  }

  ~Node() { cout << this << ": destroyed" << endl; }

  T value{};
  Node<T> *next = nullptr;
};

int main() {
  Node<int> nodes[4];

  Node<int> *node4 = &nodes[3];
  *node4 = Node<int>(4);
  Node<int> *node3 = &nodes[2];
  *node3 = Node<int>(3, node4);
  Node<int> *node2 = &nodes[1];
  *node2 = Node<int>(2, node3);
  Node<int> *LL1 = &nodes[0];
  *LL1 = Node<int>(1, node2);

  for(auto *curr = LL1; curr != nullptr; curr = curr->next) {
    cout << curr->value << " ";
  }
  cout << endl;

  return 0;
}