A puzzle involving recursive data structures ridiculously over-engineered via NodeJS and Postgres