#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;   typedef pair<int,int>pint;  typedef long double ld;   
using vll=vector<ll>;   using vs=vector<string>;
#define b2e(v)v.begin(),v.end()
#define p2a(v, p) v[p.first][p.second]

char s[(int)4e5+5],buf[(int)4e5+5];
class var { public: ll min,max,ct,sum,dif,result; };
int main() {
    ll n; cin>>n;
    cin>>s;
    ll m; cin>>m;

    bool inv=true;

    rep(i,m) {
        int a,b,c;
        cin >> a >> b >> c;
        b--; c--;
        if(a==1) {
            if(inv) swap(s[b],s[c]);
            else swap(s[(b+n)%(2*n)],s[(c+n)%(2*n)]);
        } else {
            inv=!inv;
        }
    }

    if (!inv) {
        copy(s, s+n, buf);
        copy(s+n, s+2*n, s);
        copy(buf, buf+n, s+n);
    }
    cout << s << endl;
}

#include <bits/stdc++.h>
#define ll long long
#define float double
#define sz 100005
#define all(a) a.begin(), a.end()
#define mod 1000000007
using namespace std;
#define vi vector<int>
#define vvi vector<vector<int>>
#define debug cout << "here" << endl;
#define f(i, n) for (int i = 0; i < n; ++i)
#define pb push_back
#define ff first
#define ss second
#define pi pair<int, int>
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;

using namespace std;

// ------------------------------linked list node------------------------
class Node
{
public:
    int val;
    Node *next;

    Node(int vale)
    {
        val = vale;
        next = NULL;
    }
};
//--------------------------------linked list class ---------------------
class LL
{
public:
    Node *head;
    Node *tail;
    LL()
    {
        head = NULL;
        tail = NULL;
    }
    void insert(int data)
    {
        // cout << data << endl;
        Node *newNode = new Node(data);
        // cout << newNode->val << endl;
        if (head == NULL)
        {
            head = newNode;
            tail = newNode;
        }
        else
        {
            tail->next = newNode;
            tail = newNode;
        }
    }
};
//---------------------------fast modulo exponetion ------ ---
ll pwr(ll a, ll b)
{
    a = a % mod;
    if (a == 0)
        return 0;
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = (res * a) % mod;
        }
        b = b >> 1;
        a = (a * a) % mod;
    }
    return res;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt",
            "r", stdin);
    freopen("output.txt",
            "w", stdout);
#endif
    int t;
    // cin>>t;
    t = 1;

    while (t--)
    {
        int n;
        cin >> n;

        string s;
        cin >> s;

        bool flip = false;
        int q;
        cin >> q;

        while (q--)
        {
            int t, a, b;
            cin >> t >> a >> b;

            if (t == 2)
                flip = !flip;
            else
            {
                if (!flip)
                {
                    int i = a - 1, j = b - 1;
                    swap(s[i], s[j]);
                }
                else
                {
                    int i = a - 1, j = b - 1;
                    if (i >= n)
                        i = (i + n) % n;
                    else
                        i = i + n;
                    if (j >= n)
                        j = (j + n) % n;
                    else
                        j += n;
                    swap(s[i], s[j]);
                }
            }
        }

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

#ifndef ONLINE_JUDGE
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#endif
}