n_q = gets.split(" ")
block_numbers = n_q[0].to_i
jumon_times = n_q[1].to_i

block_strings = gets.chomp!
block_strings = block_strings.split("")

all_jumon = []
for i in 1..jumon_times do
    jumon = gets.split("")
    all_jumon << jumon
end

for i in 0..all_jumon.count do
    jumon = all_jumon[i]
    block_number = jumon[0]
    move = jumon[1]
end