#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
 
using namespace std;
 
 
int main() {
    int n, q;
    int temp1,temp2,temp3;
    vector<int> t, a, b;
    string s, front, back;
 
    cin >> n;
 
    cin >> s;
    front = s.substr(0, n);
    back = s.substr(n, n);
 
    cin >> q;
 
    for (int i = 0; i < q; i++) {
        cin >> temp1 >> temp2 >> temp3;
        t.push_back(temp1);
        a.push_back(temp2);
        b.push_back(temp3);
    }
 
    
    for (int i = 0; i < q; i++) {
 
        if (t[i] == 1) {
 
            if (a[i] > n) {
                char temp = back[a[i] - n - 1];
                back[a[i] - n - 1] = back[b[i] - n - 1];
                back[b[i] - n - 1] = temp;
            }
 
            else {
                char temp = front[a[i] - 1];
 
                if (b[i] > n) {
                    front[a[i] - 1] = back[b[i] - n - 1];
                    back[b[i] - n - 1] = temp;
                }
 
                else {
                    front[a[i] - 1] = front[b[i] - 1];
                    front[b[i] - 1] = temp;
                }
            }
        }
 
        else
            front.swap(back);
 
    }
 
 
    cout << front << back << endl;
    return 0;
 
}
// Problem: D - Message from Aliens
// Contest: AtCoder - ZONe Energy Programming Contest
// URL: https://atcoder.jp/contests/zone2021/tasks/zone2021_d
// Memory Limit: 1024 MB
// Time Limit: 2000 ms

#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll  long long
#define int long long
#define ld  long double
#define endl "\n"
#define pb  push_back
#define fill(a,val) memset(a,val,sizeof(a))
#define ff  first
#define ss  second
#define test  ll t; cin>>t; while(t--)
#define loop(i,a,b)  for(ll i=a;i<b;i++)
#define loopr(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<ll,ll>
#define all(v) v.begin(),v.end()
const ll mod     = 1000*1000*1000+7;
const ll inf     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll mod2    = 998244353;
const ll N       = 1000 * 1000 + 10;
const ld pi      = 3.141592653589793;
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll ncr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}


void solve(){
    string s;
    cin>>s;
    vector<char> ans;
    for(ll i=0;i<s.length();i++){
    	if(s[i]!='R'){
    		if(ans.size() > 0 && ans[ans.size() - 1]==s[i]){
    			ans.pop_back();
    		}
    		else{
    			ans.pb(s[i]);
    		}
    	}
    	else{
    		reverse(all(ans));
    	}
    }
    for(auto i:ans) cout<<i;
    cout<<endl;
}
signed main(){
    fastio();
    // test
    solve();
    return 0;
}