adds two classes, depth first and breadth first