#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main(){
    
ll N, Q;
string S, x, y;cin >> N >> S >> Q;
bool C = 0;

x = S.substr(0, N);

y = S.substr(N, N);

rep(i, 0, Q){

    ll T, A, B;cin >> T >> A >> B;A--;B--;

    if(T == 1 && !C){

      if(A < N){

        if(B < N)swap(x[A], x[B]);

        if(N <= B)swap(x[A], y[B - N]);

      }

      if(N <= A)swap(y[A - N], y[B - N]);

    } 
    
    if(T == 1 && C){

      if(A < N){

        if(B < N)swap(y[A], y[B]);

        if(N <= B)swap(y[A], x[B - N]);

      }

      if(N <= A)swap(x[A - N], x[B - N]);

    }

    if(T == 2){

        if(C)C = 0;

        else C = 1;

    }
}

if(C)cout << y << x;

else cout << x << y;

}

#include <bits/stdc++.h>
using namespace std;

//LPFI
int main()
{
	int n, q;
	cin >> n;
	string s;
	cin >> s;
	cin >> q;
	/*string s1 = s.substr(0, n);
	string s2 = s.substr(n, 2 * n);*/
	string s1, s2;
	for (int i = 0; i < n; i++)
		s1 += s[i];
	for (int i = n; i < 2 * n; i++)
		s2 += s[i];
	int t, a, b;
	while(q--)
	{
		cin >> t >> a >> b;
		if (t == 1)
		{
			if (a <= n && b <= n)
			{
				swap(s1[a - 1], s1[b - 1]);
			}
			else if (a > n && b <= n)
			{
				if (a == 2 * n)
					swap(s2[n - 1], s1[b - 1]);
				else
				{
					a -= n;
					swap(s2[a - 1], s1[b - 1]);
				}
			}
			else if (a <= n && b > n)
			{
				if (b == 2 * n)
					swap(s1[a - 1], s2[n - 1]);
				else
				{
					b -= n;
					swap(s1[a - 1], s2[b - 1]);
				}
			}
			else if (a > n && b > n)
			{
				if (a == 2 * n)
					a = n;
				else
					a -= n;
				if (b == 2 * n)
					b = n;
				else
					b -= n;
				swap(s2[a - 1], s2[b - 1]);
			}
		}
		else if (t == 2)
			swap(s1, s2);
	}
	s = s1 + s2;
	cout << s << endl;
	return 0;
}