map{@a=@a[0,2..$#a,1];@q=map"@a[$_,$#a-$_]",0..$#i;print"?@q ";/ /,$c[getc~~'>'?$`:$']++,getc for@q}2..(@a=(@i=++$|..<>,(0)x@i));print"!@{[sort{$c[$a]-$c[$b]}@i]}"