#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define rep(i, n) for(int i=0;i<n;i++)
#define all(i, v) for(auto& i : v)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

ll n;
ll solve(ll m){
    if(m >= n) m -= n;
    else m += n;
    return m;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll q;
    string s;
    cin >> n >> s >> q;
    bool maki = 0;
    ll t, a, b;

    rep(i, q){
        cin >> t >> a >> b;
        a--; b--;

        if(t == 1){
            if(maki) {
                a = solve(a);
                b = solve(b);
            }
            swap(s[a], s[b]);
        }else{
            maki ^= 1;
        }
    }
    if(maki){
        cout << s.substr(n, n);
        cout << s.substr(0, n) << endl;
    }else{
        cout << s << endl;
    }

    return 0;
}



//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD_17 = 1e9 + 7;
const int INF = 1e9 + 1001010;
const double PI = 3.14159265358979;
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

int main(){
    int n; string s; cin >> n >> s;
    int q; cin >> q;
    int t_2 = 0;
    for(int i = 0; i < q; i++){
        int t, a, b; cin >> t >> a >> b;
        if(t == 2){
            t_2++;
            continue;
        }

        a--; b--;
        if(t_2 %2 == 1){
            a = (a+n) % (2*n);
            b = (b+n) % (2*n);
        }
        swap(s[a], s[b]);
    }

    if(t_2%2 == 1) s = s.substr(n) + s.substr(0,n);

    cout << s << endl;
}