#include<iostream>
#include <string>
#include <algorithm>

int n;
int q;
std::string s;

int t,a,b;

int main()
{
    std::cin >> n >> s >> q;

    std::string sh[2];

    sh[0] = s.substr(0,n);
    sh[1] = s.substr(n,s.size());

    for(int i=0;i<q;++i){
        std::cin >> t >> a >> b;
        if(t == 1){
            std::swap(sh[(a-1)/n].at((a-1) % n),sh[(b-1)/n].at((b-1) % n));
        }
        else{
            std::swap(sh[0],sh[1]);   
        }
    }

    std::cout << sh[0] << sh[1] << std::endl;

    return 0;
}
 

 
//IQ134高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007
#define MODB  998244353 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}



int main() {
	ll ans = 0;
	ll tmp = 0;
	int n; cin >> n;
	string s; cin >> s;
	int q; cin >> q;
	bool fliped = false;
	int t, a, b;
	REP(tr, q){
		cin >> t >> a >> b;
		if(t == 1){
			if(fliped) swap(s[(a-1+n)%(2*n)], s[(b-1+n)%(2*n)]);
			else swap(s[a-1], s[b-1]);
		}
		else fliped = !fliped;
	}
	if(fliped) cout << s.substr(n, n) + s.substr(0, n) << endl;
	else cout << s << endl;
}