letter = ("a".."z").to_a
while true do
  n = gets.to_i
  break if n == 0
  message = gets.chomp
  operation = Array.new
  n.times do
    operation.push(gets.split.map(&:to_i))
  end
  n.times do
    a, b = operation.pop
    difference = b - a
    message[a - 1], message[b - 1] = message[b - 1], message[a - 1]
    message[a - 1] = letter[(letter.index(message[a - 1]) + difference)%letter.size]
    message[b - 1] = letter[(letter.index(message[b - 1]) + difference)%letter.size]
  end
  puts message
end