<>; $a[$_]=++$%for glob<>; $m>$a[$_]or$h{$_}=$m=$a[$_]for glob<>; $,=$/;print sort keys%h