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

typedef long long ll;
typedef pair<int, int> pi;
typedef pair<long long, long long> pl;

#define all(x) (x).begin(), (x).end()
#define each(x, a) for (auto& x : a)
#define rep(i, b, e) for (int i=(b); i<(e); ++i)
#define repi(i, b, e, c) for (int i=(b); (c)>0?i<(e):i>(e); i+=(c))
#define vt vector
#define sz(x) (int)(x).size()

void solve() {
	int n, q, t, a, b;
	string s;
	cin >> n >> s >> q;
	bool f = false;
	rep(i, 0, q) {
		cin >> t >> a >> b;
		if (t == 1) {
			--a;
			--b;
			if (f) {
				a = (a+n)%(2*n);
				b = (b+n)%(2*n);
			}
			swap(s[a], s[b]);
		}
		if (t == 2) f = !f;
	}
	if (f) {
		s = s.substr(n) + s.substr(0, n);
	}
	cout << s << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define LL long long
#define LD long double
#define y1 ___y1
#define next ___next
#define left ___left
#define right ___right
#define pii pair<int, int>
#define pll pair<LL, LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<pii>
#define vll vector<pll>
#define PQ priority_queue
#define ffo fflush(stdout)
#define gch getchar()
#define e (int)(1e9 + 7)
#define ri(X) scanf("%d", &(X))
#define rii(X, Y) scanf("%d%d", &(X), &(Y))
#define riii(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define rl(X) scanf("%lld", &(X))
#define rll(X, Y) scanf("%lld%lld", &(X), &(Y))
#define rlll(X, Y, Z) scanf("%lld%lld%lld", &(X), &(Y), &(Z))
#define printi(X) printf("%d", (int)(X))
#define printii(X, Y) printf("%d %d", (int)(X), (int)(Y))
#define printiii(X, Y, Z) printf("%d %d %d", (int)(X), (int)(Y), (int)(Z))
#define printl(X) printf("%lld", (LL)(X))
#define printll(X, Y) printf("%lld %lld", (LL)(X), (LL)(Y))
#define printlll(X, Y, Z) printf("%lld %lld %lld", (LL)(X), (LL)(Y), (LL)(Z))
#define enter printf("\n")
#define space printf(" ")
struct node {
    int x, y;
    bool operator < (const node &T) const {
        return x < T.x;
    }
};
LL power(LL a, LL p) {
    if (p == 0) return 1;
    if (p == 1) return a;
    LL tmp = power(a, p / 2);
    if (p % 2) tmp = tmp * tmp % e * a;
    else tmp *= tmp;
    return tmp % e;
}
int hp, heap[1005];
void heap_push(int x) {
    heap[++hp] = x;
    int p = hp;
    while (p > 1 && heap[p / 2] > x) {
        heap[p] = heap[p / 2];
        heap[p / 2] = x;
        p /= 2;
    }
    return;
}
int heap_top() {
    if (hp == 0) return -1;
    return heap[1];
}
int heap_pop() {
    if (hp == 0) return -1;
    int re = heap[1];
    heap[1] = heap[hp];
    hp--;
    int p = 1, tmp;
    while (1) {
        if (p * 2 > hp) break;
        if (p * 2 == hp) {
            if (heap[p * 2] < heap[p]) {
                tmp = heap[p * 2];
                heap[p * 2] = heap[p];
                heap[p] = tmp;
            }
            break;
        }
        if (heap[p] > heap[p * 2] && heap[p * 2 + 1] >= heap[p * 2]) {
            tmp = heap[p * 2];
            heap[p * 2] = heap[p];
            heap[p] = tmp;
            p *= 2;
        }
        else if (heap[p] > heap[p * 2 + 1] && heap[p * 2] >= heap[p * 2 + 1]) {
            tmp = heap[p * 2 + 1];
            heap[p * 2 + 1] = heap[p];
            heap[p] = tmp;
            p = p * 2 + 1;
        }
        else break;
    }
    return re;
}

int T;
char s[500005];
int bb;

void solve() {
    int n, q, t, a, b;
    bb = 0;
    scanf("%d\n%s", &n, s + 1);
    scanf("%d", &q);
    for (int i = 1; i <= q; i++) {
        scanf("%d%d%d", &t, &a, &b);
        if (t == 1) {
            if (bb) {
                if (a <= n) a += n;
                else a -= n;
                if (b <= n) b += n;
                else b -= n;
                char c = s[a];
                s[a] = s[b];
                s[b] = c;
            }
            else {
                char c = s[a];
                s[a] = s[b];
                s[b] = c;
            }
        }
        else {
            bb = 1 - bb;
        }
    }
    if (bb) {
        for (int i = n + 1; i <= 2 * n; i++) {
            printf("%c", s[i]);
        }
        for (int i = 1; i <= n; i++) {
            printf("%c", s[i]);
        }
    }
    else {
        for (int i = 1; i <= n; i++) {
            printf("%c", s[i]);
        }
        for (int i = n + 1; i <= 2 * n; i++) {
            printf("%c", s[i]);
        }
    }
    enter;
    return;
}

int main() {
        solve();
    return 0;
}