#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define rng(v) v.begin(),v.end()
#define rngr(v) v.rbegin(),v.rend()
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using P3 = tuple<int, int, int>;
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define vs vector<string>
using vp = vector<P>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using CP = complex<double>;
double dot( const CP &z, const CP &w ){ return (z.real()*w.real() + z.imag()*w.imag()); }
double cross( const CP &z, const CP &w ){ return (z.real()*w.imag() - z.imag()*w.real()); }
int main()
{
    int n;
    string s;
    int q;
    cin >> n >> s >> q;
    bool rev = false;
    auto id = [&](int i){
        if(i < n) return i+n;
        else return i-n;
    };
    while(q--){
        int t, a, b;
        cin >> t >> a >> b;
        --a;--b;
        if(t==1){
            if(!rev) swap(s[a], s[b]);
            else {
                swap(s[id(a)], s[id(b)]);
            }
        }else{
            // string x = s.substr(0, n);
            // string y = s.substr(n);
            // s = y+x;
            rev = !rev;
        }
    }
    if(rev) {
        string x = s.substr(0, n);
        string y = s.substr(n);
        s = y+x;
    }
    cout << s << endl;
    return 0;
}
// URL
#include <iostream>
#include <string>
using namespace std;

#define loop(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define pb push_back
#define sz size
#define rsz resize
typedef long long LL;
const char NL = '\n';
const char SP = ' ';
const char HB[] = "HOBA";
const LL llinf = 9e18;
const int iinf = 2e9;

int main() {
  ios_base::sync_with_stdio(false);
  int n, q;
  cin >> n;
  string s;
  cin >> s >> q;
  string p1(s.begin(), s.begin() + n), p2(s.begin() + n, s.end());
  bool left_in_p1 = true;
  loop (j, 0, q) {
    int t, a, b;
    cin >> t >> a >> b;
    if (t == 2) {
      left_in_p1 = !left_in_p1;
    }
    else {
      a--;
      b--;
      if (a < n && b < n) {
        if (left_in_p1) {
          swap(p1[a], p1[b]);
        }
        else {
          swap(p2[a], p2[b]);
        }
      }
      else if (a < n && b >= n) {
        if (left_in_p1) {
          swap(p1[a], p2[b % n]);
        }
        else {
          swap(p2[a], p1[b % n]);
        }
      }
      else if (a >= n && b >= n) {
        a %= n;
        b %= n;
        if (left_in_p1) {
          swap(p2[a], p2[b]);
        }
        else {
          swap(p1[a], p1[b]);
        }
      }
    }
  }
  if (left_in_p1) {
    cout << p1 << p2 << NL;
  }
  else {
    cout << p2 << p1 << NL;
  }
  return 0;
}
/*
SAMPLE
*/