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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;


int main() {
  int n; cin >> n;
  string s; cin >> s;

  int q; cin >> q;
  bool flag = false;
  for (int i = 0; i < q; i++) {
    int t, a, b; cin >> t >> a >> b;
    if(t == 1){
      if(flag){
        if(a <= n && b <= n){
          a = a + n - 1;
          b = b + n - 1;
        }else if(n < a && n < b){
          a = a - n - 1;
          b = b - n - 1;
        }else{
          a = a + n - 1;
          b = b - n - 1;
        }
        char ta = s[a];
        char tb = s[b];
        s[a] = tb;
        s[b] = ta;
      }else{
        char ta = s[a - 1];
        char tb = s[b - 1];
        s[a - 1] = tb;
        s[b - 1] = ta;
      }
    }else{
      flag = !flag;
    }
  }

  string t = s + s;
  if(flag) cout << t.substr(n, 2 * n) << endl;
  else cout << s << endl;

  return 0;
}

#include<bits/stdc++.h>
#define int long long
#define rint regester int
const int maxn = 1e6 + 10;
const int INF = 1e9;
using std::ios;
using std::cin;
using std::cout;
using std::max;
using std::min;
using std::sort;
using std::unique;
using std::lower_bound;
using std::swap;
using std::abs;
using std::acos;
using std::queue;
using std::map;
using std::string;
int read(){int x = 0,f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){if(ch == '-')f = -1; ch = getchar();}while(ch >= '0' && ch <= '9'){x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar();} return x * f;}
int n, q, op, t, a, b;
char s[maxn];
signed main(){
	cin >> n >> s + 1;
	q = read();
	while(q--){
		t = read(), a = read(), b = read();
		if(t == 2)op ^= 1;
		if(t == 1){
			if(op == 1){
				if(a > n)a -= n;else a += n;
				if(b > n)b -= n; else b += n;
			}
			swap(s[a], s[b]);
		}
	}
	if(op == 1){
		for(int i = n + 1; i <= n + n; i++)cout << s[i];
		for(int i = 1; i <= n; i++)cout << s[i];
	}else
	for(int i = 1; i <= n + n; i++)cout << s[i]; 
}