#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include<bits/stdc++.h>
using namespace std;

int main()
{  long long n , q; cin >> n; string s; cin >> s; cin >> q;
int arr[q][3]; int sum = 0;
for(int i = 0 ; i < q ; i++){
    for(int j = 0 ; j < 3 ; j++){cin >> arr[i][j];}
    if(arr[i][0]%2==0){sum++;}
    else if (arr[i][0]==1 && sum%2==0){ char a = s[arr[i][1]-1];
     s[arr[i][1]-1] =  s[arr[i][2]-1];
      s[arr[i][2]-1] = a;                }
      else{ if(arr[i][1]<=n){ arr[i][1]+=n   ;    }
      else {arr[i][1]-=n;}
      if(arr[i][2]<=n){ arr[i][2]+=n   ;    }
      else {arr[i][2]-=n;}

        char a = s[arr[i][1]-1];
     s[arr[i][1]-1] =  s[arr[i][2]-1];
      s[arr[i][2]-1] = a;
      }

} if(sum%2==0){cout << s << endl; return 0;}
else{s = s.substr(n,n)+s.substr(0,n);
}
cout << s << endl;


}
//------------------------------------------
// C++ templete
//------------------------------------------
#include <bits/stdc++.h>
#define int long long
using namespace std;

//type
//------------------------------------------
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;

//REPEAT
//------------------------------------------
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(), (a).end()
#define PRINT(V)       \
    for (auto v : (V)) \
    cout << v << " "
#define SORT(V) sort((V).begin(), (V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
#define SZ(x) ((int)(x).size())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 2147483647; //1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

//math
//------------------------------------------
int QP(int a, int b)
{
    int ans = 1;
    do
    {
        if (b & 1)
            ans = 1ll * ans * a % MOD;
        a = 1ll * a * a % MOD;
    } while (b >>= 1);
    return ans;
}
int QP(int a, int b, int MOD)
{
    int ans = 1;
    do
    {
        if (b & 1)
            ans = 1ll * ans * a % MOD;
        a = 1ll * a * a % MOD;
    } while (b >>= 1);
    return ans;
}
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

//debug
//------------------------------------------
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N, M, K, Q;
vector<pair<int, int>> WV, X;

//main
//------------------------------------------
ll LCM(ll a, ll b)
{
    return a * b / GCD(a, b);
}

signed main()
{

    string S;
    cin >> N;
    cin >> S;
    cin >> Q;
    bool rev = false;
    int T, A, B;
    char c;
    REP(i, 0, Q){
        cin >> T >> A >> B;
        A--; B--;
        if (rev) {
            A = (A + N) % (2*N);
            B = (B + N) % (2*N);
        }
        if (T == 1) {
            c = S[A];
            S[A] = S[B];
            S[B] = c;
        } else {
            rev = !rev;
        }
    }
    if(rev){
      cout<<S.substr(N, N)<<S.substr(0, N)<<endl;
    }else{
      cout<<S<<endl;
    }
    return 0;
}