#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const double pi=3.1415926535897932384626;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
const int maxn=4e5+5;
int n,q,t,a,b,cnt;
char s[maxn];
int main(){
	n=read();
	scanf("%s",s+1);
	q=read();
	while(q--){
		t=read(),a=read(),b=read();
		if(t&1){
			if(cnt&1){
				if(a<=n) a+=n;
				else a-=n;
				if(b<=n) b+=n;
				else b-=n;
			}
			swap(s[a],s[b]);
		}
		else ++cnt;
	}
	if(cnt&1){
		for(int i=1;i<=n;++i) swap(s[i],s[i+n]);
	}
	printf("%s\n",s+1);
	return 0;
}
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int N, Q;
    cin >> N;

    char S1[N], S2[N];
    for(int i=0;i<N;i++){
        cin >> S1[i];
    }
    for(int i=0;i<N;i++){
        cin >> S2[i];
    }

    cin >> Q;
    int flip = 0;

    for(int i=0;i<Q;i++){
        int T, A, B;
        char tmp;
        cin >> T >> A >> B;
        if(T==2){
            flip = 1 - flip;
        }else{
            if(flip==0){
                if(B<=N){
                    tmp = S1[A-1];
                    S1[A-1] = S1[B-1];
                    S1[B-1] = tmp;
                }else if(N+1<=A){
                    tmp = S2[A-N-1];
                    S2[A-N-1] = S2[B-N-1];
                    S2[B-N-1] = tmp;
                }else{
                    tmp = S1[A-1];
                    S1[A-1] = S2[B-N-1];
                    S2[B-N-1] = tmp;
                }
            }else{
                if(B<=N){
                    tmp = S2[A-1];
                    S2[A-1] = S2[B-1];
                    S2[B-1] = tmp;
                }else if(N+1<=A){
                    tmp = S1[A-N-1];
                    S1[A-N-1] = S1[B-N-1];
                    S1[B-N-1] = tmp;
                }else{
                    char tmp = S2[A-1];
                    S2[A-1] = S1[B-N-1];
                    S1[B-N-1] = tmp;
                }
            }
        }
    }

    if(flip==0){
        for(int i=0;i<N;i++){
            cout << S1[i];
        }
        for(int i=0;i<N;i++){
            cout << S2[i];
        }
        cout <<endl;
    }else{
        for(int i=0;i<N;i++){
            cout << S2[i];
        }
        for(int i=0;i<N;i++){
            cout << S1[i];
        }
        cout <<endl;
    }


  	return 0;
}


