#include <iostream>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;
#include <vector>
#include <queue>
#include <numeric>

#define MM (1000000000 + 7)
typedef unsigned long long ull;

int N, Q;
string S;
int T, A, B;
string ans;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int i, j, k;
	bool l = false;
	int m, n;


	cin >> N >> S >> Q;

	for (i = 0; i < Q; i++) {
		cin >> T >> A >> B;
		if (T == 1) {
			int m = A - 1;
			int n = B - 1;

			if (l) {
				m += N;
				m %= (N << 1);
				n += N;
				n %= (N << 1);
			}
			char tmp = S[m];
			S[m] = S[n];
			S[n] = tmp;
		}
		else {
			l = !l;
		}
	}

	if (l) {
		ans = "";
		for (i = N; i < 2 * N; i++) {
			ans += S[i];
		}
		for (i = 0; i < N; i++) {
			ans += S[i];
		}
		cout << ans << '\n';
	}
	else {
		cout << S << '\n';
	}

	return 0;
}

#include <cassert>
#include <cctype>
#include <cerrno> 
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main()
{
int n,q,k;
string s;
cin>>n>>s>>q;
k=0;
vector<int> v(3*q);
for(int i=0; i<3*q; i++) cin>>v.at(i);
for(int i=0; i<q; i++){
    if(v.at(3*i)==1){
        if(k%2==0){
            string x;
            x=s.at(v.at(3*i+1)-1);
            s.at(v.at(3*i+1)-1)=s.at(v.at(3*i+2)-1);
            s.at(v.at(3*i+2)-1)=x.at(0);
        }
        else{
            string x;
            x=s.at((v.at(3*i+1)-1+n)%(2*n));
            s.at((v.at(3*i+1)-1+n)%(2*n))=s.at((v.at(3*i+2)-1+n)%(2*n));
            s.at((v.at(3*i+2)-1+n)%(2*n))=x.at(0);
        }
    }
    else k++;
}
if(k%2==1){
      s = s.substr(n,n)+s.substr(0,n);
}
cout<<s<<endl;

}