implement solve and solve and print