#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cstdlib>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;
#define MOD 1000000007
#define PI 3.1415926535897932
#define INF 1e18
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repe(i, j, n) for (ll i = j; i < n; i++)
#define repi(i, n) for (ll i = 0; i <= n; i++)
#define repie(i, j, n) for (ll i = j; i <= n; i++)
#define all(x) x.begin(), x.end()
#define println() cout << endl
#define P pair<ll, ll>
#define fi first
#define se second
using Graph = vector<vector<ll>>;

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

ll dp[2000][2000];
ll nCr(ll n, ll r)
{
       if(n==r) return dp[n][r] = 1;
       if(r==0) return dp[n][r] = 1;
       if(r==1) return dp[n][r] = n%MOD;
       if(dp[n][r]) return dp[n][r]%MOD;
       return dp[n][r] = nCr(n-1,r)%MOD + nCr(n-1,r-1)%MOD;
}
 
ll H(ll n, ll r) {
    return nCr(n+r-1, r)%MOD;
}

int prime[10000000];
bool is_prime[100000000 + 1];
 
int sieve(int n) {
    int pcnt = 0;
    for(int i = 0; i <= n; i++) {
        is_prime[i] = true;
    }
 
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <= n; i++) {
        if(is_prime[i]) {
            prime[pcnt++] = i;
            for(int j = 2*i; j <= n; j += i) {
                is_prime[j] = false;
            }
        }
    }
 
    return pcnt;
}

struct UnionFind {
	//自身が親であれば、その集合に属する頂点数に-1を掛けたもの
	//そうでなければ親のid
	vector<ll> r;
	UnionFind(ll N) {
		r = vector<ll>(N, -1);
	}
	ll root(ll x) {
		if (r[x] < 0) return x;
		return r[x] = root(r[x]);
	}
	bool unite(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		if (r[x] > r[y]) swap(x, y);
		r[x] += r[y];
		r[y] = x;
		return true;
	}
	ll size(ll x) {
		return -r[root(x)];
	}
 
    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};


void solve1() {
    ll n, q; string s; cin >> n >> s >> q;
    string pre, post;
    pre = s.substr(0, n);
    post = s.substr(n, n);
    bool f = true;
    //cout << pre << " " << post << endl;
    rep(i, q) {
        int t, a, b; cin >> t >> a >> b;
        if(t == 1) {
         
                if(a <= n && b <= n) {
                    swap(pre[a-1], pre[b-1]);
                } else if(a <= n && b > n) {
                    swap(pre[a-1], post[b-1-n]);
                } else {
                    swap(post[a-1-n], post[b-1-n]);
                }
        } else {
            swap(post, pre);
          
        }
    }
  
  cout << pre + post << endl;
}

int main()
{
    solve1();
}

#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;
//Arr.find_by_order(k-1):kth smallest
//Arr.order_of_key(X):no. of elements less than x
#define int long long 
#define ld long double
#define dob double
#define pb push_back
#define tle ios_base::sync_with_stdio(false);cin.tie(NULL);
const int hell=1e9+7;
#define maxheap priority_queue<int>
#define minheap priority_queue<int, vector<int>, greater<int>>
int inf=1e18;
const int N=1e5+9;
//getline(cin,st);   To Take Entire Sentence In Input; 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

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


int power(int a,int b,int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
} 



 
int32_t main()
{
	tle
	int t=1;
	// cin>>t;
	//precompute();
	
	while(t--)
	{
		
		int n;
		cin>>n;
		
		string s;
		cin>>s;
		
		int q;
		cin>>q;
		
		int ct=0;
		
		for(int i=0;i<q;i++)
		{
			int typ,l,r;
			cin>>typ>>l>>r;
			
			if(typ==1)
			{
				if(ct%2==0)
				swap(s[l-1],s[r-1]);
				else
				{
					if(l<=n)
					l=l+n;
					else
					l=l-n;
					
					if(r<=n)
					r=r+n;
					else
					r=r-n;
					
					swap(s[l-1],s[r-1]);
				}
			}
			else
			ct++;
		}
		
		// reverse(s.begin(),s.end());
		if(ct%2==1)
		s=s.substr(n)+s.substr(0,n);
		cout<<s;
	   
	}
	
	return 0;
}