Added a method that prints the solution