a=`dd`.split (n,m),op=[a.shift(2).map(&:to_i),a.shift] b=a.shift(m).map(&:to_i) a=a.map(&:to_i) n.times{|i|puts b.map{|e|a[i].send(op,e)}*' '}