alphabets = ("a".."z").to_a
l = alphabets.length
h = {}
alphabets.each_with_index{|c, i| h[c] = i}
while true
    n = gets.to_i
    break if n == 0

    message = gets.chomp
    arr = []
    n.times{arr << gets.chomp.split.map(&:to_i)}
    arr.reverse_each{|a, b|
        diff = b - a
        c = alphabets[(h[message[a - 1]] + diff) % l]
        d = alphabets[(h[message[b - 1]] + diff) % l]
        message[a - 1] = d
        message[b - 1] = c
    }
    puts message
end

