//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word
//Incase of close mle change language to c++17 or c++14 

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007ll //998244353ll
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)    
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }
int l;
int dp[300][15];
int fun(int pos, int rem)
{
    if(rem<0)
    return 0;
    if(pos>=l)
    {
        if(rem==0)
        return 1;
        return 0;
    }
    if(dp[pos][rem]!=-1)
    return dp[pos][rem];
    return dp[pos][rem]=fun(pos+1, rem)+fun(pos+1, rem-1);
}
int32_t main()
{
    IOS;
    fill(dp, -1);
    cin>>l;
    cout<<fun(1, 11);
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define  FIFO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define  inf 2e18
#define  mod 998244353
#define  bg begin()
#define  en end()
#define  ll long long int
#define  pb push_back
#define  mp make_pair
#define  pii pair<int,int>
#define  pll pair<ll,ll>
#define  vi vector<int>
#define  vll vector<long long int>
#define  vpll vector<pair<long long int,long long int> >
#define  vpii vector<pair<int,int> >
#define  vstr vector<string>
#define  mpii map<int ,int>
#define  mpll map<long long int,long long int >
#define  max3(arr,brr,ser) max(arr,max(brr,ser))
#define  min3(arr,brr,ser) min(arr,min(brr,ser))
#define  setbits(x) __builtin_popcountll(x)
#define  zerobits(x) __builtinctzll(x) //zeros after rightmost set bit
#define  w(t) ll t; cin>>t; while(t--)
#define  vin(v,G) for(int i=0;i<G;i++){ll x;cin>>x; v.pb(x);}
#define  for0(i,G) for(int i=0;i<G;i++)
#define  for1(i,G) for(int i=1;i<=G;i++)
#define  forn(i,arr,brr) for(int i=arr;i<=brr;i++)
#define  forv(it,v) for(auto it=v.begin();it!=v.end();it++)
#define  mem(arr,val) memset(arr,val,sizeof(arr))
#define  Sort(vec) sort(vec.begin(),vec.end())
#define  RSort(vec) sort(vec.rbegin(),vec.rend())
#define  eb emplace_back
#define  bs binary_search
#define  lb(v,arr) lower_bound(v.begin(),v.end(),arr)
#define  ub(v,arr) upper_bound(v.begin(),v.end(),arr)
#define  deb1(x) cerr<<#x<<": "<<x<<" "<<endl
#define  deb2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define  deb3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define  deb4(arr, brr, ser, d) cerr<<#arr<<": "<<arr<<" | "<<#brr<<": "<<brr<<" | "<<#ser<<": "<<ser<<" | "<<#d<<": "<<d<<endl
#define  FF first
#define  SS second
#define  yes "YES"
#define  no "NO"
#define  PI 3.141592653589793238462643383279502884L
#define printv(v) for(int i=0;i<v.size();i++) cout<<v[i]<<" "
// find_by_order(p)  returns iterator to kth element starting from 0;
// order_of_key(p) returns count of elements strictly smaller than p;
//order of key returns the index if the element was present.(If not present)
template <typename T>
using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll Ceil(ll arr, ll brr) {return arr / brr + (arr % brr != 0);}
ll Logn(ll G, ll right) {return (G > right - 1) ? 1 + Logn(G / right, right) : 0;}
ll fastModExp(ll arr, ll brr) { ll res = 1; while (brr > 0) { if (brr & 1)res = (res * arr) % mod; arr = (arr * arr) % mod; brr = brr >> 1; } return res;}
ll GCD(ll arr, ll brr) { if (brr == 0)return arr; else  return GCD(brr, arr % brr);}
//Chrnlgy: Binary Search,Greedy,dp,dfs and similar
int main()
{
	// w(t)
	// {
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll q;
	cin >> q;
	string s1, s2;
	s1 = s.substr(0, n);
	s2 = s.substr(n, n);
	while (q--) {
		ll t, a, b;
		cin >> t >> a >> b;
		if (t == 1)
		{
			a--;
			b--;
			if (a < s1.length() && b < s1.length())
			{
				swap(s1[a], s1[b]);
			}
			else if (a >= s1.length() && b >= s1.length())
				swap(s2[a - n], s2[b - n]);
			else
			{
				char ch = s1[a];
				s1[a] = s2[b - n];
				s2[b - n] = ch;
			}

		}
		if (t == 2)
		{
			swap(s1, s2);

		}
	}
	cout << s1 + s2 << endl;
	return 0;
}
