($i,$j,$v)=split,$h[$i+=9e2][$j+=9e2]=$v,@i=sort(@i,$i),@j=sort@j,$j for<>;for$j($j[0]..$j[-1]){for$i($i[0]..$i[-1]){print$h[$i][$j]//'-'}print$/}