#include "bits/stdc++.h"
using namespace std;
#include "string"
#define int long long
#define pi pair<int, int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define endl '\n'
#define vi vector<int>

int32_t main() {
   boost;
   int n;
   cin >> n;
   string s;
   cin >> s;
   int q;
   cin >> q;
   int f = 0;
   while(q--) {
      int t, a, b;
      cin >> t >> a >> b;
      a--, b--;
      if(t == 1) {
         if(f) {
            if(a < n)
               a += n;
            else a -= n;
            if(b < n)
               b += n;
            else b -=n;
         }
         swap(s[a], s[b]);
      }
      else f ^= 1;
   }
   if(f)
      s = s.substr(n) + s.substr(0, n);
   cout << s << endl;
}



#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool s_first = true;//true_s1,false_s2
void swap_char(vector<char>&,vector<char>&,int,int,int);
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<char> s1(n);
    vector<char> s2(n);
    for(int i = 0;i < n;i++){
        s1[i] = s[i];
    } 
    for(int i = 0;i < n;i++){
        s2[i] = s[i+n];
    }
    int q;
    cin >> q;
    for(int i = 0;i < q;i++){
        int t,a,b;
        cin >> t >> a >> b;
        a--;
        b--;
        if(t == 1){
            if(s_first){
                swap_char(s1,s2,a,b,n);
            }else{
                swap_char(s2,s1,a,b,n);
            }
        }
        if(t == 2){
            s_first = !s_first;
        }
        
    }
    if(s_first){
        for(auto i:s1){
            cout << i;
        }
        for(auto i:s2){
            cout << i;
        }
        cout << endl;
    }else{
        for(auto i:s2){
            cout << i;
        }
        for(auto i:s1){
            cout << i;
        }
        cout << endl;
    }


    return 0;
}

void swap_char(vector<char>& s1,vector<char>& s2,int a,int b,int n){

    if(a >= n){
        if(b >= n){
            swap(s2[a-n],s2[b-n]);
        }else{
            swap(s2[a-n],s1[b]);
        }
    }else{
        if(b >= n){
            swap(s1[a],s2[b-n]);
        }else{
            swap(s1[a],s1[b]);
        }
    }
    return;

}
