// Author : Naresh Bharasagar
// Instt. : Indian Institute of Technology Guwahati
 
//--------------------------------------------------------------------------------------------------------------------------------
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int loo;
typedef long double ld;
 
#pragma GCC target ("sse4.2")
#define ordered_set(a) tree<a, null_type,less<a>, rb_tree_tag,tree_order_statistics_node_update>
#define loop(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define loopset(it,val,dtype) for(set<dtype>::iterator it=val.begin(); it!=val.end(); it++)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vloo vector<loo>
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
#define ploo pair<loo,loo>
#define fillz(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
#define outa(a,n) loop(i,0,n) cout << a[i] << " ";
#define pr(a) cout << a << "\n";
#define pb(l) push_back(l)
#define ff first
#define ss second
#define input(a) for(auto &i: a) cin >> i;
#define deb(i) cout << "[" << #i << "=" << i << "]" << endl;
#define nl cout << "\n";
#define INF 1000000000
#define M 1000000007
 
loo power(loo x, loo y, loo p) { 
    loo res = 1;
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res*x) % p; 
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
}
 
bool sortbysec(const pair<loo,loo> &a, const pair<loo,loo> &b) { 
    return (a.second > b.second); 
}
 
string decToBin(loo n) {
	string s = "0";
	if(n == 0) return s;
	s = "";
    while (n > 0) { 
        s += (n % 2) + '0';
        n = n / 2;
    }
    reverse(s.begin(), s.end());
    return s;
}
 
loo binToDec(string s) {
    loo ans = 0;
    reverse(s.begin(), s.end());
    loop(i, 0, s.size()) ans += pow(2, i)*(s[i] - '0');
    return ans;
}
 
loo nCr(loo n, loo r) {
    loo p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            loo m = __gcd(p, k); 
            p /= m; 
            k /= m; 
            n--; 
            r--; 
        }
    } 
    else p = 1; 
    return p; 
}
 
// vector<int> dist;
vector<bool> vis(100001,false);
void dfs(vector<loo> adj[], loo src) {
    vis[src]=true;
    loop(i,0,adj[src].size()) {
        loo x = adj[src][i];
        if(vis[x]==false) {
            vis[x]=true;
            // dist[x] = dist[src]+1;
            dfs(adj,x);
        }
    }
}
 
// vector<loo> sg(100001,-1); //prev
void bfs(vector<loo> adj[], loo src) {
    list<loo> ql;
    vis[src]=true;
    ql.pb(src);
    while(!(ql.empty())) {
        src = ql.front();
        // cout << src << " ";
        ql.pop_front();
 
        loop(i,0,adj[src].size()) {
            if(!vis[adj[src][i]]) {
                vis[adj[src][i]]=true;
                // sg[adj[src][i]]=src;
                ql.pb(adj[src][i]);
            }
        }
    }
}
 
// ----------------------------------------------------------------
void solve() {
    loo n;
    cin >> n;
    string s;
    cin >> s;
    loo q;
    cin >> q;
    loo t,a,b;
    bool f = false;
    while(q--) {
        cin >> t >> a >> b;
        a--,b--;
        if(t==1) {
            if(f) a=(a+n)%(2*n), b=(b+n)%(2*n);
            swap(s[a],s[b]);
        }
        else {
            f^=1;
        }
    }
    if(f) cout << s.substr(n,n)+s.substr(0,n);
    else cout << s;
    nl;
}
 
int main() {
	fast_io
 
    // freopen("validation_input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
 
    loo q = 1;
    // cin >> q;
    while(q--) {
        solve();
    }
 
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define ll long long

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

    int n;
    cin >> n;
    string s;
    cin >> s;
    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 q;
    cin >> q;
    while(q-- > 0) {
        int t, i, j;
        cin >> t >> i >> j;
        if(t == 1) {
            if(i >= 1 && j <= n) {
                swap(a[i - 1], a[j - 1]);
            }
            else if(i > n && j <= 2 * n) {
                i -= n, j -= n;
                swap(b[i - 1], b[j - 1]);
            }
            else {
                j -= n;
                swap(a[i -1], b[j - 1]);
            }
        }
        else {
            swap(a, b);
        }
    }
    cout << a << b << endl;
}