#! ruby # yukicoder My Practice # author: Leonardone @ NEETSDKASU def gs(); gets.chomp; end def gi(); gets.to_i; end def gss(); gets.chomp.split; end def gis(); gss.map(&:to_i); end n = gi t = gis d = gis td = (1..n).zip(t,d).sort{|(i1,t1,d1),(i2,t2,d2)| t1 != t2 ? t1 <=> t2 : d1<=> d2 } puts td.map{|i1,t1,d1| i1} * " "