% ?- river(N,R,L,S,A,B,C,D,E,F,G).
% ?- river(N,R,L,S,A,B,C,D,E,F,G), S \= null.
% ?- lake(N,A,B,C,D,R,E,F), R \= null.
toSea(N,S) :- river(N,_R,_L,S,_,_,_,_,_,_,_), S \= null.
toSea(N,S) :- river(N,R,_L,_S,_,_,_,_,_,_,_), R \= null, toSea(R,S).
toSeaLake(N,S) :- lake(N,_,_,_,_,R,_,_), R \= null, toSea(R,S).
toSea(N,S) :- river(N,_R,L,_,_,_,_,_,_,_,_), L \= null, toSeaLake(L,S).

