Prolog exercises