n = gets.to_s.to_i64 n.times do s = gets.to_s x = s.split[2].to_i y = x.succ.to_s puts s.gsub(x.to_s,y) end