Added dedupe method. Fixed valid method. Print solutions on separate lines