#include<bits/stdc++.h>
using namespace std;
int main(){

    int n,q;
    cin>>n>>q;

    vector<char> v( n-1 );

    for(int lj=0;lj<q;lj++){

        int tip;
        cin>>tip;

        int a,b;
        cin>>a>>b;
        a--;
        b--;

        char ch;

        if(tip == 1){

            cin>>ch;
            v[a] = ch;
        }

        if(tip == 2){

            bool bul = true;

            for(int i=0;i<b-a;i++){

                if(v[a+i] != v[b-1-i]){
                    bul = false;
                    break;
                }

            }
            if(bul){
                cout<<1<<endl;
            }
            else{
                cout<<0<<endl;
            }
        }
    }
}