Solve ProgramHierarchy from Assignment 2