Prolog Final Exam