loop do
    switch_num, light_num, ope_num = gets.split.map(&:to_i)
    break if switch_num == 0
    alph = (?0..?9).to_a + (?A..?Z).to_a
    alph = alph[0..switch_num-1]

    candidates = (1..light_num).map { (1 << switch_num) - 1 }
    switch_state = 0
    ope_num.times do
        ope, light_state = gets.split.map{|s| s.to_i(2)}
        switch_state ^= ope
        (0..light_num-1).each do |i|
            if light_state[i] == 1
                candidates[i] &= switch_state
            else
                candidates[i] -= candidates[i] & switch_state
            end
        end
    end

    a = (0..light_num-1).map do |i|
        x = candidates[i]
        if x & (x - 1) == 0
            alph[- Math.log2(x).to_i - 1]
        else
            ??
        end
    end
    puts a.reverse.join
end