#include <bits/stdc++.h>
using namespace std;

#define _GLIBCXX_DEBUG
// 2の27乗＝１億３千万
#define rep(i, n, N) for (int i = n; i < (int)(N); i++)
#define ascending(array) sort(array.begin(), array.end())
#define descending(array) sort(array.rbegin(), array.rend())
#define log(name, message) cout << name << " = " << message << endl
#define out(content) cout << content << endl
#define max(array) *max_element(array.begin(), array.end())
#define min(array) *min_element(array.begin(), array.end())
#define roundUp(a, b) (a + (b - 1)) / b
#define element(array) \
  for (auto&& el : array) log("el", el)

int main() {
  string S;
  cin >> S;

  deque<char> deq;
  bool rev = false;
  for (auto&& el : S) {
    if (el == 'R') {
      rev = !rev;
    } else {
      if (rev) {
        deq.push_front(el);
      } else {
        deq.push_back(el);
      }
    }
  }
  if (rev) reverse(deq.begin(), deq.end());

  string T;
  if (deq.size()) {
    for (auto&& el : deq) {
      if (T.size() && T.back() == el)
        T.pop_back();
      else
        T.push_back(el);
    }
    out(T);
  } else {
    out("");
  }
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
 
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define tm (tl+tr)/2
#define child 2*v
#define ceils(s,n) (s+n-1)/n
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 3e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;
ll seg[4*N];
ll a[N],n,query;
void build(ll v,ll tl,ll tr){
    if(tl==tr){
        seg[v]=a[tl];
    }
    else{
        build(child,tl,tm);
        build(child+1,tm+1,tr);
        seg[v]=(seg[child]^seg[child+1]);
    }
}
void update(ll v,ll tl,ll tr,ll pos,ll val){
    if(tl==tr){
        seg[v]=val^a[tl];
    }
    else{
        if(pos<=tm){
            update(child,tl,tm,pos,val);
        }
        else{
            update(child+1,tm+1,tr,pos,val);
        }
        seg[v]=(seg[child]^seg[child+1]);
    }
}
ll rquery(ll v,ll tl,ll tr,ll ql,ll qr){
    if(ql>qr){
        return 0;
    }
    if(ql==tl and qr == tr){
        return seg[v];
    }
    return (rquery(child,tl,tm,ql,min(qr,tm))^rquery(child+1,tm+1,tr,max(ql,tm+1),qr));
}


int main() {    
    fast();
    cin >> n >> query;
    f(i,1,n+1){
        cin >> a[i];
    }
    build(1,1,n);
    ll index,val,ql,qr;
    f(i,0,query){
        ll type;
        cin >> type;
        if(type==1){
            cin >> index >> val;
            update(1,1,n,index,val);
            a[index] = a[index] ^ val;
        }
        else{
            cin >> ql >> qr;
            cout<<rquery(1,1,n,ql,qr)<<edl;
        }
    }
    return 0;
}
