#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int MOD=1e9+9;

long long n,a[N],b[N];
int solve() {
    cin>>n;
    string s,str1="",str2="";
    cin>>s;
    for(int i=0;i<2*n;i++)
    {
        if(i<n)
            str1+=s[i];
        else
            str2+=s[i];
    }
    bool cur=0;
    int q;
    cin>>q;
    while(q--)
    {
        int t, i,j;
        cin>>t>>i>>j;
        i--;
        j--;
        if(i>j)
            swap(i,j);
        if(t==1 && cur==0)
        {
            if(i<n && j<n)
                swap(str1[i],str1[j]);
            else if(i>=n && j>=n)
                swap(str2[i-n],str2[j-n]);
            else
            {
                j-=(n);
                swap(str1[i],str2[j]);
            }
        }
        else if(t==1 && cur==1)
        {
            if(i<n && j<n)
                swap(str2[i],str2[j]);
            else if(i>=n && j>=n)
                swap(str1[i-n],str1[j-n]);
            else
            {
                j-=n;
                swap(str2[i],str1[j]);
            }
        }
        else
            cur^=1;
    }
    if(cur==0)
        cout<<str1<<str2;
    else
        cout<<str2<<str1;
    return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt" ,"r" ,stdin);
    freopen("output.txt" ,"w" ,stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    /*int t;
    cin>>t;
    while(t--)*/
        solve();
    return 0;
}
#include<iostream>
#include<vector>
#include<algorithm>
#include<random>
#include<map>
long long int realOdometer = 0;
long long int manhattanOdometer = 0;
long long int generalAverage = 0;
using namespace std;
int main(){
  pair<int, int>s, t;
  map<pair<pair<int, int>, pair<int, int>>, pair<int, int>>distance;
  int loopCount = 0;
  while(cin >> s.first >> s.second >> t.first >> t.second){
    string str = "";
    for(int i=0; i<abs(t.first-s.first); i++){
      str = str + (t.first-s.first>0? "D": "U");
    }
    for(int i=0; i<abs(t.second-s.second); i++){
      str = str + (t.second-s.second>0? "R": "L");
    }
    mt19937 g(loopCount);
    shuffle(str.begin(), str.end(), g);
    if(loopCount<2){
      cout << str << endl;
    }else{
      str.clear();
      pair<int, int>currentPos = s;
      while(currentPos!=t){
        if(currentPos.first==t.first||currentPos.second==t.second){
          if(currentPos.first==t.first){
            str.push_back(currentPos.second<t.second? 'R': 'L');
          }else{
            str.push_back(currentPos.first<t.first? 'D': 'U');
          }
        }else{
          pair<int, int>component0 = make_pair(currentPos.first, currentPos.second + (currentPos.second<t.second? +1: -1));
          pair<int, int>component1 = make_pair(currentPos.first + (currentPos.first<t.first? +1: -1), currentPos.second);
          pair<pair<int, int>, pair<int, int>>candidate0 = make_pair(currentPos, component0);
          pair<pair<int, int>, pair<int, int>>candidate1 = make_pair(currentPos, component1);
          if(candidate0.first>candidate0.second){
            swap(candidate0.first, candidate0.second);
          }
          if(candidate1.first>candidate1.second){
            swap(candidate1.first, candidate1.second);
          }
          int d0 = distance[candidate0].first!=0? distance[candidate0].first: generalAverage;
          int d1 = distance[candidate1].first!=0? distance[candidate1].first: generalAverage;
          if(d0<d1){
            str.push_back(currentPos.second<t.second? 'R': 'L');
          }else{
            str.push_back(currentPos.first<t.first? 'D': 'U');
          }
        }
        currentPos.first+= (str.back()=='D') - (str.back()=='U');
        currentPos.second+= (str.back()=='R') - (str.back()=='L');
      }
      cout << str << endl;
    }
    long long int D;
    cin >> D;
    realOdometer+= D;
    manhattanOdometer+= str.length();
    generalAverage = realOdometer/manhattanOdometer;
    int manhattan_d = str.length();
    vector<pair<pair<int, int>, pair<int, int>>>toDoList;
    for(int i=0; i<manhattan_d; i++){
      pair<int, int>temp1, temp2;
      if(i!=0){
        temp1 = toDoList.back().second;
      }else{
        temp1 = s;
      }
      auto convert = [&](char c){
        pair<int, int> val = temp1;
        if(c=='R'||c=='L'){
          val = make_pair(val.first, val.second + (c=='R'? +1: -1));
        }else{
          val = make_pair(val.first + (c=='D'? +1: -1), val.second);
        }
        return val;
      };
      temp2 = convert(str.at(i));
      toDoList.push_back(make_pair(temp1, temp2));
    }
    while(toDoList.size()!=0){
      if(toDoList.back().first>toDoList.back().second){
        swap(toDoList.back().first, toDoList.back().second);
      }
      distance[toDoList.back()].second++;
      distance[toDoList.back()].first = 
        (distance[toDoList.back()].first * (distance[toDoList.back()].second-1)
        + D/manhattan_d)/distance[toDoList.back()].second;
      toDoList.pop_back();
    }
    loopCount++;
  }
  return 0;
}