Prolog Code