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

typedef long long ll;
typedef pair<int,int> P;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"
#define COUT16(x) cout << fixed << setprecision(16) << (x) << "\n";


int main(){
    //input
    int n,q,t,a,b;
    string s;
    cin >> n >> s >> q;
    //input-計算
    int flip = 0;//正常
    for(int i=0;i<q;i++){
        cin >> t >> a >> b;
        --a;--b;
        if(t==1){
            if(flip==0){//正常
                char s1 = s[a],s2 = s[b];
                s[b] = s1;s[a] = s2;
            }
            else{//反転
                if(a<n&&b<n){
                    char s1 = s[n+a],s2 = s[n+b];
                    s[n+b] = s1;s[n+a] = s2;
                }
                else if(a<n&&n<=b){
                    char s1 = s[n+a],s2 = s[b-n];
                    s[b-n] = s1;s[n+a] = s2;
                }
                else{
                    char s1 = s[a-n],s2 = s[b-n];
                    s[b-n] = s1;s[a-n] = s2;
                }
            }
        }
        else{
            if(flip==0)flip = 1;
            else flip = 0;
        }
    }
    if(flip)cout << s.substr(n,n) << s.substr(0,n) << endl;
    else COUT(s);
}


// for(int i = 0; i < n; i++) {cin >> a[i];}

#include <bits/stdc++.h>

using namespace std;

#define pb	push_back
#define mp	make_pair
#define gcd __gcd
#define F   first
#define S   second
#define pii pair<int,int>

using ll = long long;

bool isSubsequence(string s, string t) {
	int index = 0;
	if(s.length() == 0) {
		return true;
	}
	for(int i = 0; i < t.length(); i++) {
		if(s.at(index) == t.at(i)){
			index++;
		}
		if(index == s.length()) {
			return true;
		}
	}
	return false;
}

bool isPrime(int n) {
	for(int i = 2; i < int(sqrt(n))+1; i++) {
		if(n%i==0) {
			return false;
		}
	}
	return true;
}

bool isInt(double n) {
	if(floor(n) == ceil(n)) {
		return true;
	}
	return false;
}

bool isPalindrome(string s) {
	int n = s.length();
	for(int i = 0; i < n/2; i++) {
		if(s.at(i) != s.at(n-i-1)) {
			return false;
		}
	}
	return true;
}

bool distinctDigits(int n) {
	string s = to_string(n);
	for(int i = 0; i < s.length(); i++) {
		for(int j = i+1; j < s.length(); j++) {
			if(s.at(i)==s.at(j)) {
				return false;
			}
		}
	}
	return true;
}

bool distinctDigits(string s) {
	for(int i = 0; i < s.length(); i++) {
		for(int j = i+1; j < s.length(); j++) {
			if(s.at(i)==s.at(j)) {
				return false;
			}
		}
	}
	return true;
}

int digitSum(int n) {
	int ans = 0;
	string s = to_string(n);
	for(int i = 0; i < s.length(); i++) {
		ans += stoi(s.substr(i, 1));
	}
	return ans;
}

int swapBits(int n, int p1, int p2) {
	int bit1 = (n >> p1) & 1;
	int bit2 = (n >> p2) & 1;

	int x = bit1 ^ bit2;
	x = (x << p1) | (x << p2);

	return n ^ x;
}

void display(vector<int> a) {
	for(auto element : a) {
		cout << element << ' ';
	}
	cout << endl;
}

void display(vector<ll> a) {
	for(auto element : a) {
		cout << element << ' ';
	}
	cout << endl;
}

void display(vector<string> a) {
	for(auto element : a) {
		cout << element << ' ';
	}
	cout << endl;
}

void solve()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int q;
	cin >> q;

	int flips = 0;
	for(int i = 0; i < q; i++) {
		int t, a, b;
		cin >> t >> a >> b;

		if(flips%2 == 1) {
			if(a > n) {
				a -= n;
			} else {
				a += n;
			}
			if(b > n) {
				b -= n;
			} else {
				b += n;
			}
		}

		if(t==1) {
			// cout << a << ' ' << b << endl;
			swap(s[a-1], s[b-1]);
		} else {
			flips++;
		}
		// cout << s << endl;
	}
	if(flips%2 == 1) {
		s = s.substr(n, n) + s.substr(0, n);
	}
	cout << s;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	// int t;
	// cin >> t;
	// for(int i = 1; i <= t; i++) {
	// 	// cout << "Case #" << i << ": ";
	// 	solve();
	// }

	solve();

	cout.flush();
	return 0;
}