:- auto_table.

:- export
	protagonist/2,
	found_h1/2.

:- import append/3 from lists.

protagonist(element(h1,A,B), Protag) :-
	found_h1(element(h1,A,B), Protag).

protagonist(element(_,_,L), Protag) :-
	protagonist(L, Protag).

protagonist([X|L], Protag) :-
	protagonist(X, Protag), !;
	protagonist(L, Protag).

found_h1(element(_,_,L), Protag) :-
	found_h1(L, Protag).

found_h1([], []).

found_h1([X|L], S3) :-
	write(X), nl,
	found_h1(X, S1),
	found_h1(L, S2),
	append(S1, S2, S3).

found_h1(Protag, Protag).

