@r[glob<>]=1..<>;$d>$r[$_]or$d=$r[$o[$_]=$_.$/]for glob<>;print@o