#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> *next = nullptr;
  for(int i = 3; i >= 0; --i) {
    nodes[i] = Node<int>(i+1, next);
    next = &nodes[i];
  }

  Node<int> *LL1 = &nodes[0];

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

  return 0;
}