import sys

def main():

    input = sys.stdin.readline

    H,W,N = list(map(int, input().split()))

    start = tuple(map(int, input().split()))

    S = input().rstrip()

    T = input().rstrip()

    D = {

        'R': (0,1),

        'L': (0,-1),

        'U': (-1,0),

        'D': (1,0)

    }

    Dc = ['R', 'L', 'U', 'D']



    def move(current, direction):

        d = D[direction]

        return (current[0]+d[0], current[1]+d[1])



    def is_dropped(a):

        return not (1<=a[0]<=H and 1<=a[1]<=W)



    ans = True

    for i in range(4):

        cur = start

        for j in range(N):

            if S[j] == Dc[i]:

                cur = move(cur, Dc[i])

                if is_dropped(cur): ans = False

            if T[j] == Dc[i^1]:

                cur = move(cur, Dc[i^1])

                if is_dropped(cur): cur = move(cur, Dc[i])

    print(('YES' if ans else 'NO'))



if __name__ == '__main__':

    main()
H, W, N = list(map(int, input().split()))

*s, = [int(x) - 1 for x in input().split()]

S = eval(input())

T = eval(input())

l = t = 0

b = H

r = W

if S[-1] == 'L':

    l += 1

elif S[-1] == 'R':

    r -= 1

elif S[-1] == 'U':

    t += 1

else:

    b -= 1



for i in range(N - 2, -1, -1):

    a = T[i]

    if a == 'L':

        r += 1

        r = min(r, W)

    elif a == 'R':

        l -= 1

        l = max(l, 0)

    elif a == 'U':

        b += 1

        b = min(b, H)

    else:

        t -= 1

        t = max(t, 0)

    a = S[i]

    if a == 'L':

        l += 1

    elif a == 'R':

        r -= 1

    elif a == 'U':

        t += 1

    else:

        b -= 1

    if b <= t or r <= l:

        print('NO')

        exit()



print(('YES' if t <= s[0] < b and l <= s[1] < r else 'NO'))

import sys


def main():
    input = sys.stdin.readline
    H, W, N = list(map(int, input().split()))
    start = tuple(map(int, input().split()))
    S = input().rstrip()
    T = input().rstrip()
    D = {"R": (0, 1), "L": (0, -1), "U": (-1, 0), "D": (1, 0)}
    Dc = ["R", "L", "U", "D"]

    def move(current, direction):
        d = D[direction]
        return (current[0] + d[0], current[1] + d[1])

    def is_dropped(a):
        return not (1 <= a[0] <= H and 1 <= a[1] <= W)

    ans = True
    for i in range(4):
        cur = start
        for j in range(N):
            if S[j] == Dc[i]:
                cur = move(cur, Dc[i])
                if is_dropped(cur):
                    ans = False
            if T[j] == Dc[i ^ 1]:
                cur = move(cur, Dc[i ^ 1])
                if is_dropped(cur):
                    cur = move(cur, Dc[i])
    print(("YES" if ans else "NO"))


if __name__ == "__main__":
    main()

H, W, N = list(map(int, input().split()))
(*s,) = [int(x) - 1 for x in input().split()]
S = eval(input())
T = eval(input())
l = t = 0
b = H
r = W
if S[-1] == "L":
    l += 1
elif S[-1] == "R":
    r -= 1
elif S[-1] == "U":
    t += 1
else:
    b -= 1
for i in range(N - 2, -1, -1):
    a = T[i]
    if a == "L":
        r += 1
        r = min(r, W)
    elif a == "R":
        l -= 1
        l = max(l, 0)
    elif a == "U":
        b += 1
        b = min(b, H)
    else:
        t -= 1
        t = max(t, 0)
    a = S[i]
    if a == "L":
        l += 1
    elif a == "R":
        r -= 1
    elif a == "U":
        t += 1
    else:
        b -= 1
    if b <= t or r <= l:
        print("NO")
        exit()
print(("YES" if t <= s[0] < b and l <= s[1] < r else "NO"))

-import sys - - -def main(): -    input = sys.stdin.readline -    H, W, N = list(map(int, input().split())) -    start = tuple(map(int, input().split())) -    S = input().rstrip() -    T = input().rstrip() -    D = {"R": (0, 1), "L": (0, -1), "U": (-1, 0), "D": (1, 0)} -    Dc = ["R", "L", "U", "D"] - -    def move(current, direction): -        d = D[direction] -        return (current[0] + d[0], current[1] + d[1]) - -    def is_dropped(a): -        return not (1 <= a[0] <= H and 1 <= a[1] <= W) - -    ans = True -    for i in range(4): -        cur = start -        for j in range(N): -            if S[j] == Dc[i]: -                cur = move(cur, Dc[i]) -                if is_dropped(cur): -                    ans = False -            if T[j] == Dc[i ^ 1]: -                cur = move(cur, Dc[i ^ 1]) -                if is_dropped(cur): -                    cur = move(cur, Dc[i]) -    print(("YES" if ans else "NO")) - - -if __name__ == "__main__": -    main() +H, W, N = list(map(int, input().split())) +(*s,) = [int(x) - 1 for x in input().split()] +S = eval(input()) +T = eval(input()) +l = t = 0 +b = H +r = W +if S[-1] == "L": +    l += 1 +elif S[-1] == "R": +    r -= 1 +elif S[-1] == "U": +    t += 1 +else: +    b -= 1 +for i in range(N - 2, -1, -1): +    a = T[i] +    if a == "L": +        r += 1 +        r = min(r, W) +    elif a == "R": +        l -= 1 +        l = max(l, 0) +    elif a == "U": +        b += 1 +        b = min(b, H) +    else: +        t -= 1 +        t = max(t, 0) +    a = S[i] +    if a == "L": +        l += 1 +    elif a == "R": +        r -= 1 +    elif a == "U": +        t += 1 +    else: +        b -= 1 +    if b <= t or r <= l: +        print("NO") +        exit() +print(("YES" if t <= s[0] < b and l <= s[1] < r else "NO"))