#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define mod 1e9+7
#define inf 1e18
#define N 1000043
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define loop(a,b) for(int i=a;i<b;i++)
#define test int t; cin >> t; while(t--)
#define pll pair<ll,ll>
#define int ll
using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    string str;
    cin >> str;
    vector<int>vec(n,0);
    bool x=false;
    int q;
    cin >> q;
    for(int i=0;i<q;i++){
        int t,a,b;
        cin >> t >> a >> b;
        if(t==1){
            a--;b--;
            if(x)  {
                if(a<n)
                    a=n+a;
                else    
                    a=a-n;
                if(b<n)
                    b=n+b;
                else    
                    b=b-n;
            }
            swap(str[a],str[b]);    
        }else{
            x=!x;
        }
    }
    if(x){
        for(int i=0;i<n;i++){
            swap(str[i],str[n+i]);
        }
    }
    cout << str << endl;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <iterator>
#include <stack>
#include <queue>
#include <functional>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
using namespace std;

#define ll long long
#define double long double
#define vi vector<int>
#define vvi vector<vi>
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>

int main()
{
    ll n, q;
    string S;
    int rev = 0;
    int t, a, b;
    cin >> n;
    cin >> S;
    cin >> q;

    for (size_t i = 0; i < q; i++)
    {
        cin >> t >> a >> b;
        if (t == 1)
        {
            if (rev)
            {
                if (a > n)
                {
                    a -= n;
                }
                else
                {
                    a += n;
                }

                if (b > n)
                {
                    b -= n;
                }
                else
                {
                    b += n;
                }
            }
            swap(S[a - 1], S[b - 1]);
        }
        else
        {
            if (rev)
            {
                rev = 0;
            }
            else
            {
                rev = 1;
            }
        }
    }
    if (rev == 0)
    {
        cout << S << endl;
    }
    else
    {
        cout << S.substr(n) << S.substr(0, n) << endl;
    }

    return 0;
}
