Monkey and Banana problem in prolog.