#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef vector<vi> vii;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  int n;
  cin >> n;
  string s; cin>>s;
  int q;
  cin >> q;
  int sw = 0;
  while(q--){
  	int t; cin >> t;
  	int a, b; cin >> a >> b;
  	a--, b--;
  	if(t == 2){
  		sw^=1;
  	}
  	else{
  		if(sw){
  			if(a < n){
  				a+= n;
  			}
  			else{
  				a-=n;
  			}
  			if(b < n){
  				b+= n;
  			}
  			else{
  				b-=n;
  			}	
  		}
  		swap(s[a], s[b]);
  	}
  }
  if(sw){
  	for(int i = n; i < 2*n ; i++)
  		cout << s[i];
  	forn(i, n){
  		cout << s[i];
  	}
  	cout << "\n";
  }
  else{
  	for(auto i:s)
  		cout << i;
  	cout << "\n";
  }
  return 0;
}
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<int, ll> PIL;
typedef pair<ll, int> PLI;
typedef pair<ll, ll> PLL;
typedef bitset<16> BS;
struct edge {
    int to, cost, id;
};
const double PI = 3.14159265358979323846;
const double EPS = 1E-09;
const ll MOD = 1E+09 + 7; // =998244353;
const ll INFL = 1E18;
const int INFI = 1E09;
const int MAX_N = 2E+05;

ll dx[4] = { -1, 1, 0, 0 }, dy[4] = { 0, 0, -1, 1 };

int N, Q;

string S;

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

    cin >> N >> S >> Q;
    //cout << "S = " << S << ", T = " << T << "\n";

    bool mv = false;
    for (int i = 1; i <= Q; i++) {
        int t, a, b;
        cin >> t >> a >> b;
        a--;
        b--;
        if (t == 1) {
            if (!mv) {
                swap(S[a], S[b]);
            } else {
                if (a >= N)
                    a -= N;
                else
                    a += N;

                if (b >= N)
                    b -= N;
                else
                    b += N;

                swap(S[a], S[b]);
            }
        } else {
            mv = !mv;
        }
    }

    /*
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << "i = " << i << ", j = " << j << ", dp = " << dp[i][j] << "\n";
        }
    }
    */
    string ans = "";
    if (mv) {
        string l = S.substr(0, N);
        string r = S.substr(N, N);
        ans = ans + r + l;
    } else {
        ans = S;
    }

    cout << ans << "\n";
    return 0;
}