#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 
#include <unordered_set>
#include <unordered_map>

using namespace std;

using ll = long long;
using ull = unsigned long long;

#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

constexpr int INF = 1e9+7;
constexpr ll INFL = 9*1e18;

constexpr int dx[4] = { 1, 0, -1, 0 };
constexpr int dy[4] = { 0, 1, 0, -1 };

// constexpr int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
// constexpr int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

int inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
ull inline power(ull a,ull b){ull res = 1;rep(i,b)res *= a;return res;}
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
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; }
template<typename T>inline void print(T&& x){cout<<setprecision(32)<<x<<endl;}
string to_oct(int n){string s;while(n){s = to_string(n%8) + s;n /= 8;}return s;}

int main(){
  int n;cin>>n;
  string s;cin>>s;
  int q;cin>>q;
  bool reversed = false;
  rep(i,q){
    int t;cin>>t;
    int a,b;cin>>a>>b;a--;b--;
    if(reversed){
      a = (a + n) % (2*n);
      b = (b + n) % (2*n);
    }

    if(t == 1){
      swap(s[a],s[b]);
    }else{
      reversed = !reversed;
    }
  }
  if(reversed){

    string t1 = s.substr(0,n);
    string t2 = s.substr(n,2*n);
    s = t2 + t1;

  }
  print(s);
  
  return 0;
}
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

std::string s;

int main(void){
	int n,i,m,t,a,b,q;
	bool flag = false;
	std::cin >> n;
	std::cin >> s;
	std::cin >> q;
	m = s.l_ength();
	for(i=0; i<q; ++i){
		std::cin >> t >> a >> b;
		--t; --a; --b;
		if(t){
			flag = (!flag);
		}else{
			a += (flag?n:0); a %= m;
			b += (flag?n:0); b %= m;
			std::swap(s[a],s[b]);
		}
	}
	for(i=0; i<m; ++i){
		std::cout << s[(flag?((i+n)%m):i)];
	}
	std::cout << std::endl;
	return 0;
}
