/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package changingbit;

import java.util.Scanner;

/**
 *
 * @author Intellitech
 */
public class Solution {

    /**
     * @param args the command line arguments
     */
    static int[] a, b, c;
    static String output = "";
    
    public static int[] binaryAdd(int[] A, int[] B)
    {
        int[] C = new int[A.length + 1];
        int carry = 0;

        for (int i = 0; i < C.length - 1; i++)
        {
            int _sum = A[i] + B[i] + carry;
            switch(_sum)
            {
                case 0: {C[i] = 0; carry = 0; break;}
                case 1: {C[i] = 1; carry = 0; break;}
                case 2: {C[i] = 0; carry = 1; break;}
                case 3: {C[i] = 1; carry = 1; break;}
            }
        }
        C[C.length - 1] = carry;
        return C;
    }

    public static void processQuery(String query)
    {
        String[] tokens = query.split(" ");
        if (tokens[0].equalsIgnoreCase("set_a") == true)
        {
            a[Integer.parseInt(tokens[1])] = Integer.parseInt(tokens[2]);
            c = binaryAdd(a, b);
            return;
        }

        if (tokens[0].equalsIgnoreCase("set_b") == true)
        {
            b[Integer.parseInt(tokens[1])] = Integer.parseInt(tokens[2]);
            c = binaryAdd(a, b);
            return;
        }

        if (tokens[0].equalsIgnoreCase("get_c") == true)
        {            
            output += String.valueOf(c[Integer.parseInt(tokens[1])]);
        }
    }
    public static void initialize(char[] _a, char[] _b)
    {
        a = new int[_a.length];
        b = new int[_b.length];
        c = new int[(a.length) + 1];

        
        for (int i = _a.length - 1; i >= 0; i--)
        {
            a[a.length  - i - 1] = Integer.parseInt(String.valueOf(_a[i]));
            b[a.length  - i - 1] = Integer.parseInt(String.valueOf(_b[i]));
        }
        c = binaryAdd(a, b);
    }
    public static void main(String[] args) {
        // TODO code application logic here
        
        Scanner console = new Scanner(System.in);
        String input = console.nextLine();
        int cases = Integer.parseInt((input.split(" "))[1]);
        initialize(console.nextLine().toCharArray(), console.nextLine().toCharArray());
        
        for (int i = 0; i < cases; i++)
        {            
            processQuery(console.nextLine());
        }

        System.out.println(output);
    }
}