Add code to print the final solution