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


int main() {
  int N,Q;
  cin >> N;
  string S;
  cin >> S>> Q;
  int t,a,b;
  char c;
  string St;
  int Fcnt = 0;
  for(int q=0;q<Q;q++){
  	cin >> t>> a>> b;
    a--;
    b--;
    if(t==1){
      if(Fcnt%2==0){
    	c = S.at(a);
      	S.at(a) = S.at(b);
      	S.at(b) = c;
      	}else{
        if(a<N){
        a+=N;
        }else{
        a-=N;
        }
        if(b<N){
        b+=N;
        }else{
        b-=N;
        }
        //a=(a+N)%(N*2);
        //b=(b+N)%(N*2);
        
      	c = S.at(a);
      	S.at(a) = S.at(b);
      	S.at(b) = c;
      }
    }else{
      Fcnt++;
      /*
    	St=S;
      	for(int i=0;i<N;i++){
        	S.at(i)=S.at(i+N);
          	S.at(i+N)=St.at(i);
        }
        */
    }
  }
  
  if(Fcnt%2==1){
    St=S;
  	for(int i=0;i<N;i++){
       	S.at(i)=S.at(i+N);
       	S.at(i+N)=St.at(i);
    }
  }
  
  //cout << N << endl;
  cout << S << endl;
  //cout << Q << endl;
  
}
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <iomanip>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#define rep(i,n) for (int i = 0; i < n; i++)
#define PI 3.1415926535897932384626433832795028
#define INF (1<<29)
#define LINF (1LL<<60)

using namespace std;

using INT = long long;
using P = pair<int,int> ;

int main(){

    int n;
    string s;
    int q;
    cin >> n ;
    cin >> s >> q;

    vector<int> t(q),a(q),b(q);

    rep(i,q){
        cin >> t[i] >> a[i] >> b[i];
    }

    vector<int> new_a,new_b;
    int cnt=0;
    rep(i,q){
        if(t[i]==2)cnt = 1 - cnt;
        if(t[i]==1){
            if(cnt==0){
                new_a.emplace_back(a[i]);
                new_b.emplace_back(b[i]);
            }
            else {
                if(a[i]>n)new_a.emplace_back(a[i]-n);
                else new_a.emplace_back(a[i]+n);
                
                if(b[i]>n)new_b.emplace_back(b[i]-n);
                else new_b.emplace_back(b[i]+n);
                
            }
        }


    }

    rep(i,new_a.size()){
        char temp = s[new_a[i]-1];
        s[new_a[i]-1] = s[new_b[i]-1];
        s[new_b[i]-1] = temp; 
    }

    if(cnt==1){
        string copy = s;
        s.erase(0,n);
        copy.erase(n);
        s += copy;
    }

    cout << s << endl;
    return 0;
    
}