add solution with parent pointer