#include <bits/stdc++.h>
#define ll long long
#define INF 1e9
#define pb push_back
#define mp  make_pair
#define loop(a,n) for(long long i=a;i<n;i++)
#define vil vector<long long int>
#define vi vector<int>
#define sz(v) v.size()
#define setbits(x)          __builtin_popcountll(x)
#define ff first
#define ss second
#define endl '\n'
using namespace std;

///order_of_key (k) : Number of items strictly smaller than k .
///find_by_order(k) : K-th element in a set (counting from zero).
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int nCrevenoroddfinder(int n,int r)
{
    int a=r;
    int b=n-r;
    for(int i=0;i<30;i++)
    {
        int x=1<<i;
        if((x&a)&&(x&b))
        {
            return 0;//even
        }
    }
    return 1;//odd
}
ll gcd(ll a, ll b) {
  if (b == 0)return a;
  return gcd(b, a%b);
}
ll extendeddgcd(ll a,ll b, ll &x,ll &y){
      if(b==0){
           x=1,y=0;
           return a;
      }
      ll x1,y1;
      ll d=extendeddgcd(b,a%b,x1,y1);
      x=y1;
      y=x1-(a/b)*y1;
      return d;
}
bool isperfect(ll n) {
  ll y = sqrt(n);
  if (n % y == 0 && y * y == n)return true;
  return false;
}
bool comp(pair<int,int> a, pair<int,int> b) {
    if(a.first == b.first) return a.second>b.second;
  return a.first < b.first;
}
 ll powi(ll a, ll b) {
  ll ans = 1;
  while (b > 0) {
    if (b & 1)ans = (ans * a);
    b = b >> 1;
    a = (a * a);
  }
  return ans;
}
bool isprime(ll n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0)return false;
  }
  return true;
}
bool prime[10000000];
void seive() {

  prime[1] = true;
  for (int i = 2; i * i < 10000000; i++) {

    if (prime[i])continue;
    for (int j = i * i; j < 10000000; j += i) {
      prime[j] = true;
    }

  }
}
int main()
{
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int t;
  t=1;
  while(t--){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll cnt=0;
    ll q;cin>>q;
    while(q--){
          ll x;
          ll a,b;
          cin>>x>>a>>b;
          if(x==1){
                ll p,r;
                if(a<=n) p=n+a;
                else p=a-n;
                if(b<=n) r=n+b;
                else r=b-n;
                if(cnt%2){
                      swap(s[p-1],s[r-1]);
                }else swap(s[a-1],s[b-1]);
          }else cnt++;
    }
    if(cnt%2){
          for(int i=n;i<2*n;i++) cout<<s[i];
          for(int i=0;i<n;i++) cout<<s[i];
    }else
    cout<<s;
        cout<<endl;
  }
  
}



  
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define deb(x) cout << #x << " " << x << endl;
#define mod 1000000007
#define fast std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define rall(v) v.rbegin(), v.rend()
const ll INF = 1e18;
//const ll NEGINF = -1 * INF;
const ll N = 1e6 + 1;

ll gcd(ll a, ll b)
{
    if (b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}

ll my_pow(ll a, ll n, ll m = INF)
{
    ll res = 1;
    while (n)
    {
        if (n % 2)
        {
            res = (res * a) % m;
            n--;
        }
        a = (a * a) % m;
        n /= 2;
    }
    return res;
}

map<int, ll> mTrue, mFalse;
ll buildTrue(vector<bool> &a, int curr);

ll buildFalse(vector<bool> &a, int curr)
{
    int n = a.size();
    if (curr == 0)
    {
        if (a[curr])
        {
            return 1;
        }
        else
        {
            return 3;
        }
    }
    if (mFalse.find(curr) != mFalse.end())
    {
        return mFalse[curr];
    }
    ll cnt = 0;
    if (a[curr])
    {
        cnt += buildFalse(a, curr - 1);
    }
    else
    {
        cnt += 2 * buildFalse(a, curr - 1);
        cnt += buildTrue(a, curr - 1);
    }
    mFalse[curr] = cnt;
    return cnt;
}

ll buildTrue(vector<bool> &a, int curr)
{
    int n = a.size();
    if (curr == 0)
    {
        if (a[curr])
        {
            return 3;
        }
        else
        {
            return 1;
        }
    }
    if (mTrue.find(curr) != mTrue.end())
    {
        return mTrue[curr];
    }
    ll cnt = 0;
    if (a[curr])
    {
        cnt += buildFalse(a, curr - 1);
        cnt += 2 * buildTrue(a, curr - 1);
    }
    else
    {
        cnt += buildTrue(a, curr - 1);
    }
    mTrue[curr] = cnt;
    return cnt;
}

void solve()
{
    ll n;
    cin >> n;
    vector<bool> a(n);
    string t;
    for (int i = 0; i < n; i++)
    {
        cin >> t;
        if (t == "AND")
        {
            a[i] = false;
        }
        else
        {
            a[i] = true;
        }
    }
    ll cnt = buildTrue(a, n - 1);
    cout << cnt << endl;
}

int main()
{
    fast;
#ifndef ONLINE_JUDGE
    freopen("/home/kalit/Desktop/Data Structures-Algo-Competitive/src/codeforces/input.txt", "r", stdin);
    freopen("/home/kalit/Desktop/Data Structures-Algo-Competitive/src/codeforces/output.txt", "w", stdout);
#endif
    int T = 1;
    while (T--)
    {
        solve();
    }
    //cout<< "Done in " << clock() / CLOCKS_PER_SEC <<"sec"<< endl;
    return 0;
}