//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio

using namespace std;

inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }

const int N = 200000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n, m, k;
    cin >> n >> m >> k;
    int x, y;
    cin >> x >> y;
    string s, t;
    cin >> s >> t;
    int l = 0, r = m + 1;
    repb(i, k - 1, -1) {
        int d1 = -(s[i] == 'L') + (s[i] == 'R');
        int d2 = -(t[i] == 'L') + (t[i] == 'R');
        if (d1 == 0 && d2 == 0) {

        } else if (d2 == 0) {
            if (d1 == -1) {
                l++;
            } else {
                r--;
            }
        } else if (d1 == 0) {
            if (d2 == -1) {
                r = min(r + 1, m + 1);
            } else {
                l = max(l - 1, 0);
            }
        } else if (d1 == d2) {
            if (d1 == -1) {
                l++;
                r = min(r + 1, m + 1);
            } else {
                r--;
                l = max(l - 1, 0);
            }
        } else {
            if (d1 == -1) {
                l = max(l, 1);
            } else {
                r = min(r, m);
            }
        }
        if (r - l <= 1) {
            cout << "NO\n";
            return 0;
        }
    }
    if (y <= l || y >= r) {
        cout << "NO\n";
        return 0;
    }
    l = 0; r = n + 1;
    repb(i, k - 1, -1) {
        int d1 = -(s[i] == 'U') + (s[i] == 'D');
        int d2 = -(t[i] == 'U') + (t[i] == 'D');
        if (d1 == 0 && d2 == 0) {

        } else if (d2 == 0) {
            if (d1 == -1) {
                l++;
            } else {
                r--;
            }
        } else if (d1 == 0) {
            if (d2 == -1) {
                r = min(r + 1, n + 1);
            } else {
                l = max(l - 1, 0);
            }
        } else if (d1 == d2) {
            if (d1 == -1) {
                l++;
                r = min(r + 1, n + 1);
            } else {
                r--;
                l = max(l - 1, 0);
            }
        } else {
            if (d1 == -1) {
                l = max(l, 1);
            } else {
                r = min(r, n);
            }
        }
        if (r - l <= 1) {
            cout << "NO\n";
            return 0;
        }
    }
    if (x <= l || x >= r) {
        cout << "NO\n";
        return 0;
    }
    cout << "YES\n";
    return 0;
}

Measured memory_bytes: 920