#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5;
const int maxq=3e5;
char ss[maxn + 1 << 1];
int main()
{
	int n,q,t,a,b;
	scanf("%d\n%s\n%d\n",&n,ss,&q);
	int base=0;
	int l=n<<1;
	while(q-->0)
	{
		scanf("%d %d %d",&t,&a,&b);
		if(t==2)
		{
			base^=n;
		}
		else
		{// T==1
			a=(a-1+base)%l;
			b=(b-1+base)%l;
			swap(ss[a],ss[b]);
		}
	}
	for(int i=0;i<l;i++)
	{
		putchar(ss[(base+i)%l]);
	}	
 } 

#include <bits/stdc++.h>

#define rep(i, n) for (auto i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()

using namespace std;

using ll = long long int;

const int MOD_NUM = 1e9 + 7;

int main() {
    // Input
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    vector<int> T(Q), A(Q), B(Q);
    rep(i, Q) cin >> T[i] >> A[i] >> B[i];

    // Process
    string ans(S);
    int reverse = 0;
    rep(i, Q) {
        if (T[i] == 1) {
            int a = A[i] - 1;
            int b = B[i] - 1;
            if (reverse % 2 == 1) {
                a = (a + N) % (N * 2);
                b = (b + N) % (N * 2);
            }

            char tmp = ans[a];
            ans[a] = ans[b];
            ans[b] = tmp;
        } else
            reverse++;
    }
    if (reverse % 2 == 1) {
        string tmp1 = ans.substr(N);
        string tmp2 = ans.substr(0, N);
        ans = tmp1 + tmp2;
    }

    // Output
    cout << ans << endl;

    return 0;
}
