map{($a,$b,$c)=glob<>;push@{$c.-$a},$b,push@{$c.-$b},$a,0}<>=~$"..$';@a=1..$`;<>=~s/\d+/@a=sort{$a-$b}keys{map@{$&.-$_},@a}/ger;print@a." @a"