#!/usr/bin/ruby h={} r=[s=0]*5 5.times.map{|i| x,y=gets.split h[x]=[y.to_i,i] } n=[] a=3.times.map{ _h=Hash.new 0 n0=gets.to_i n<