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

int main() {

  int N, Q;

  string S;

  cin >> N >> S >> Q;

  bool flag = true;

  for (int i = 0; i < Q; i++) {
    int T, A, B;
    cin >> T >> A >> B;

    if (T == 1) {
      if (!flag) {
        if (A > N) {
          A -= N;
        } else {
          A += N;
        }
        if (B > N) {
          B -= N;
        } else {
          B += N;
        }
      }
      swap(S.at(A - 1), S.at(B - 1));
    } else {
      if (flag) {
        flag = false;
      } else {
        flag = true;
      }
    }
  }

  if (!flag) {
    for (int i = 0; i < N; i++) {
      cout << S.at(i + N);
    }
    for (int i = 0; i < N; i++) {
      cout << S.at(i);
    }
    cout << endl;
  } else {
    cout << S << endl;
  }

  return 0;

}

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

#define fastio                  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define input_output            freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 

#define int                     long long
#define all(ds)                 ds.begin(), ds.end()
#define uniq(v)                 (v).erase(unique(all(v)),(v).end())
#define gcd(x,y)                __gcd(x,y)
#define precise(x)              cout<<fixed<<setprecision(x)
#define endl                    "\n"
#define pii                     pair<int,int>
#define sz(x)                   ((int)(x).size())
#define lb                      lower_bound
#define ub                      upper_bound
#define pb                      push_back
#define ff                      first
#define ss                      second
#define ms(x,a)                 memset(x,(int)(a),sizeof(x))
#define rep(i,a,b)            for (int i=a; i<(b); i++)
#define forn(i,a)              for (int i=0; i<(a); i++)
#define repd(i,a,b)             for (int i = (b)-1; i >= a; i--)
#define ford(i,a)               for (int i = (a)-1; i >= 0; i--)
template<class T> bool gmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool gmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

template <typename Arg1>
void prn(Arg1&& arg1) { cout<<arg1<<endl;}
template <typename Arg1, typename... Args>
void prn(Arg1&& arg1, Args&&... args) { cout<<arg1<<endl; prn(args...); }

template <typename Arg1>
void prsn(Arg1&& arg1) { cout<<arg1<<endl;}
template <typename Arg1, typename... Args>
void prsn(Arg1&& arg1, Args&&... args) { cout<<arg1<<" "; prsn(args...); }

template <typename Arg1>
void prs(Arg1&& arg1) { cout<<arg1<<" ";}
template <typename Arg1, typename... Args>
void prs(Arg1&& arg1, Args&&... args) { cout<<arg1<<" "; prs(args...); }

template <typename Arg1>
void read(Arg1&& arg1) { cin>>arg1; }
template <typename Arg1, typename... Args>
void read(Arg1&& arg1, Args&&... args) { cin>>arg1; read(args...); }

const long long INF = 1e18;
const int32_t MOD = 1e9+7;
const int N = 2e5+5;


void solve(){
    int n, q; 
    string s;
    read(n,s,q);
    bool parity = false;
    forn(i,q){
        int type, x, y;
        read(type,x, y);
        if(type == 2){
            parity = !parity;
        }
        else{
            if(parity){
                if(x <= n) x += n;
                else x -= n;
                if(y <= n) y += n;
                else y -= n;
            }
            swap(s[x-1], s[y-1]);
        }
    }
    if(parity) {
        s = s.substr(n, 2*n) + s.substr(0, n);
    }
    prn(s);
}

signed main()
{
#ifndef ONLINE_JUDGE  
    input_output  
#else   
    fastio
#endif

#ifdef SIEVE
    sieve();
#endif

#ifdef NCR
    init();
#endif

    int t = 1;
    // cin>>t;
    for(int tt = 1; tt <= t; ++tt){
        // cout << "Case #" << tt << ": ";
        solve();
    }

    return 0;
}


