#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  int cnt = n + 1;
  char s1[cnt];
  char s2[cnt];
  int e = 0;
  while (e < n)
  {
    cin >> s1[e];
    e++;
  }
  s1[e] = 0;
  e = 0;
  while (e < n)
  {
    cin >> s2[e];
    e++;
  }
  s2[e] = 0;
  //cout << s1 << s2 << endl;;
  int q;
  cin >> q;
  int t[q],a[q],b[q];
  for(int i = 0; i < q; i++)
    cin >> t[i] >> a[i] >> b[i];
  int f = 1;
  for(int i = 0; i < q; i++)
  {
    if (t[i] == 1)
    {
      char k;
      char *c;
      char *d;
      if (f == -1)
      {
      if (a[i] > n)
      {
        k = s1[a[i] - n - 1];
        c = &(s1[a[i] - n - 1]);
      }
      else
      {
        k = s2[a[i] - 1];
        c = &(s2[a[i] - 1]);
      }
      //cout << k << ":" << *c << endl;
      if (b[i] > n)
      {
        //cout << "s2 : " << s2[b[i] - n - 1] << endl;;
        *c = s1[b[i] - n - 1];
        d = &(s1[b[i] - n - 1]);
      }
      else
      {
        //cout << "s1 : " << s1[b[i] - 1] << endl;;
        *c = s2[b[i] - 1];
        d = &(s2[b[i] - 1]);
      }
      }
      else
      {
              if (a[i] > n)
      {
        k = s2[a[i] - n - 1];
        c = &(s2[a[i] - n - 1]);
      }
      else
      {
        k = s1[a[i] - 1];
        c = &(s1[a[i] - 1]);
      }
      //cout << k << ":" << *c << endl;
      if (b[i] > n)
      {
        //cout << "s2 : " << s2[b[i] - n - 1] << endl;;
        *c = s2[b[i] - n - 1];
        d = &(s2[b[i] - n - 1]);
      }
      else
      {
        //cout << "s1 : " << s1[b[i] - 1] << endl;;
        *c = s1[b[i] - 1];
        d = &(s1[b[i] - 1]);
      }
      }
      //cout << *d << ":" << *c << endl;
      *d = k;
      //cout << s1 << s2 << endl;;
    }
    else if (t[i] == 2)
    {
      f *= -1;
    }
  }
  if (f == 1)
    cout << s1 << s2;
  else
    cout << s2 << s1;
}
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, i, q, a, b, t;
    bool sw = false;
    string s;
    cin >> n >> s >> q;
    while (q--)
    {
        cin >> t >> a >> b;
        // cout<<sw<<" ";
        if (t == 1)
        {
            if (sw == false)
            {
                char c = s[a - 1];
                s[a - 1] = s[b - 1];
                s[b - 1] = c;
            }
            else
            {
                if(a <= n && b <= n)
                {
                    char c = s[a + n - 1];
                    s[a + n - 1] = s[b + n - 1];
                    s[b + n - 1] = c;
                    // cout << s;
                }
                else if(a <= n && b > n)
                {
                    char c = s[a + n - 1];
                    s[a + n - 1] = s[b - n - 1];
                    s[b - n - 1] = c;
                    // cout << s;
                }
                else if(a > n && b > n)
                {
                    char c = s[a - n - 1];
                    s[a - n - 1] = s[b - n - 1];
                    s[b - n - 1] = c;
                    // cout << s;
                }
                else
                {
                    char c = s[a - n - 1];
                    s[a - n - 1] = s[b + n - 1];
                    s[b + n - 1] = c;
                    // cout << s;
                }
            }
        }
        else
        {
            sw = !sw;
        }
    }
    if(sw)
        s = s.substr(n,n) + s.substr(0,n);
    cout << s;
    return 0;
}