Prolog_Multi-layer recursion