Extract Tree & Node classes to use on other problems