sub p { my($g,$s,$e,%v)=@_;$s eq$e?[$e]:map{map[$s,@$_],p($g,$_,$e,%v,$s,1)}grep!$v{$_},keys%{$$g{$s}} }