/*
      ___           ___           ___           ___           ___           ___           ___          _____          ___           ___           ___
     /  /\         /__/\         /  /\         /__/\         /  /\         /__/\         /  /\        /  /::\        /  /\         /  /\         /  /\
    /  /::\       |  |::\       /  /::\        \  \:\       /  /::\       |  |::\       /  /::\      /  /:/\:\      /  /::\       /  /::\       /  /::\
   /  /:/\:\      |  |:|:\     /  /:/\:\        \__\:\     /  /:/\:\      |  |:|:\     /  /:/\:\    /  /:/  \:\    /  /:/\:\     /  /:/\:\     /  /:/\:\
  /  /:/  \:\   __|__|:|\:\   /  /:/  \:\   ___ /  /::\   /  /:/~/::\   __|__|:|\:\   /  /:/~/::\  /__/:/ \__\:|  /  /:/  \:\   /  /:/  \:\   /  /:/  \:\
 /__/:/ \__\:\ /__/::::| \:\ /__/:/ \__\:\ /__/\  /:/\:\ /__/:/ /:/\:\ /__/::::| \:\ /__/:/ /:/\:\ \  \:\ /  /:/ /__/:/ \__\:\ /__/:/ \__\:\ /__/:/ \__\:\
 \  \:\ /  /:/ \  \:\~~\__\/ \  \:\ /  /:/ \  \:\/:/__\/ \  \:\/:/__\/ \  \:\~~\__\/ \  \:\/:/__\/  \  \:\  /:/  \  \:\ /  /:/ \  \:\ /  /:/ \  \:\ /  /:/
  \  \:\  /:/   \  \:\        \  \:\  /:/   \  \::/       \  \::/       \  \:\        \  \::/        \  \:\/:/    \  \:\  /:/   \  \:\  /:/   \  \:\  /:/
   \  \:\/:/     \  \:\        \  \:\/:/     \  \:\        \  \:\        \  \:\        \  \:\         \  \::/      \  \:\/:/     \  \:\/:/     \  \:\/:/
    \  \::/       \  \:\        \  \::/       \  \:\        \  \:\        \  \:\        \  \:\         \__\/        \  \::/       \  \::/       \  \::/
     \__\/         \__\/         \__\/         \__\/         \__\/         \__\/         \__\/                       \__\/         \__\/         \__\/

*/

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define endl '\n'
#define pii pair<ll,ll>
#define F first
#define S second

using namespace std;

const int MOD=1e9+7;
const int  N=1000100;

long long po(int x,int y)
{
    if(y==0)return 1;
    int ret=po(x,y/2)%MOD;
    ret*=ret;
    ret%=MOD;
    if(y%2)ret*=x,ret%=MOD;
        return ret;
}

string s;
ll n,q;
ll a,b,c;
bool w;

void solve()
{
    cin>>n;
    cin>>s;
    cin>>q;
    while(q--){
        cin>>c>>a>>b;
        a--;b--;
        if(c==2){
            w=!w;
        }
        else{
            if(!w)
                swap(s[a],s[b]);
            else
                swap(s[a+ (a >= n ? -n : n)],s[b+ (b >=n ? -n : n)]);
        }
    }
    if(w){
        string tem=s.substr(0,n);
        s=s.substr(n,n);
        s+=tem;
    }
    cout<<s<<endl;
}

int main()
{
    //ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("gates.in","r",stdin);freopen("gates.out","w",stdout);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}

#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
// typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long
#define scn(n) scanf("%d",&n)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod = 1e9 + 7;
const int N = 1e6 + 4;
int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#ifndef ONLINE_JUDGE
#endif

    ll test=1;
//cin>>test;
    while(test--)
    {
        int n; cin>>n;
        string s; cin>>s;

        int arr[2*n]={0};

        int q; cin>>q;
        int cnt=0;

        while(q--)
        {
            int t,a,b; cin>>t>>a>>b;
            if(t==1)
            {
                if(cnt%2==1)
                {
                    if(a<=n)
                    a=a+n;
                    else
                    a=a-n;

                    if(b<=n)
                    b=b+n;
                    else
                    b=b-n;     
               

                    swap(s[a-1],s[b-1]);
                }
                else
                {
                    swap(s[a-1],s[b-1]);
                }
                
            }
            else
            {
                cnt++;
                
            }
        }

        if(cnt%2==0)
        {
            for(int i=0; i<2*n; i++)
            cout<<s[i];
        }
        else
        {
            for(int i=n; i<2*n; i++)
            cout<<s[i];
            for(int i=0; i<n; i++)
            cout<<s[i];

        }

    }
    return 0;
}