#include<bits/stdc++.h>
using namespace std;
int n;
char s[800008];
int q;
int t,a,b;
int opt=0;
int main(){
	cin>>n;
	scanf("%s",s+1);
	scanf("%d",&q);
	while(q--){
		scanf("%d%d%d",&t,&a,&b);
		if(t==2) opt++;
		else if(t==1){
			if(opt%2==0){
				swap(s[a],s[b]);
			}else{
//				cout<<"a+n="<<a+n<<"   b+n="<<b+n<<endl;
//				swap(s[(a+n)%n],s[(b+n)%n]);
				if(a<=n&&b<=n) swap(s[a+n],s[b+n]);
				if(a>=n+1&&b>=n+1) swap(s[a-n],s[b-n]);
				if(a<=n&&b>=n+1) swap(s[a+n],s[b-n]); 
			}
		}
	}
	if(opt%2==1){
		for(int i=n+1;i<=2*n;i++)
			cout<<s[i];
		for(int i=1;i<=n;i++)
			cout<<s[i];
//		for(int i=1;i<=2*n;i++)
//			cout<<s[i];
	}else {
		for(int i=1;i<=2*n;i++)
			cout<<s[i];
			
	}
	return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define int long long int
const int MOD = 1e9 + 7;
#define MAX 100005
#define CHAR_SIZE 26

int power(int x, int y){
    int res = 1;
    while (y > 0){
        if (y & 1)
            res = (res * x) % MOD;
        y = y >> 1;
        x = (x * x) % MOD;
    }
    return res;
}

int modInverse(int n){
    return power(n, MOD - 2);
}

int fac[100005];
int cache[100005];

int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

int nCrModPFermat(int n, int r){
    if (n < r)
        return 0;
    if (r == 0)
        return 1;
    return (fac[n] * modInverse(fac[r]) % MOD * modInverse(fac[n - r])) % MOD;
}

void pre_compute(){
    fac[0] = 1;
    for(int i = 1 ; i < 100005 ; i++){
        fac[i] = (fac[i - 1] * i) % MOD;
    }
}

void solveEach(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;
    string a,b;
    for(int i = 0 ; i < n ; i++) a += s[i];
    for(int i = n ; i < 2*n ; i++) b += s[i];
    int a1 = 0;
    int op;
    int i,j;
    
    while(q--){
        cin >> op >> i >> j;
        if(op == 2){
            if(a1 == 0) a1 = 1;
            else a1 = 0;
        }else{
            i--;
            j--;
            if(j < n){
                if(a1 == 0){
                    swap(a[i] , a[j]);
                }else swap(b[i] , b[j]);
            }else if(i >= n){
                i -= n;
                j -= n;
                if(a1 == 1){
                    swap(a[i] , a[j]);
                }else swap(b[i] , b[j]);
            }else if(j >= n){
                j -= n;
                if(a1 == 0){
                    swap(a[i] , b[j]);
                }else swap(a[j] , b[i]);
            }
        }
    }
    
    if(a1 == 0){
        cout << a << b ;
    }else cout << b << a;
    
    return;
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int T = 1;
    //cin >> T;
    
    for(int i = 1 ; i <= T ; i++){
        //cout << "Case #" << i << ": ";
        solveEach();
    }
    return 0;
}
/*
 AtCoder Beginner Contest 199（Sponsored by Panasonic）
 */
