H, W, N = [int(_) for _ in input().split()]

R, C = [int(_) for _ in input().split()]

S = eval(input())

T = eval(input())



#drop by up

r = R

for i in range(N):

    if S[i] == 'U':

        r -= 1

        if r == 0:

            print('NO')

            exit()

    if T[i] == 'D' and r < H:

        r += 1



#drop by down

r = R

for i in range(N):

    if S[i] == 'D':

        r += 1

        if r == H + 1:

            print('NO')

            exit()

    if T[i] == 'U' and r > 1:

        r -= 1



#drop by left

c = C

for i in range(N):

    if S[i] == 'L':

        c -= 1

        if c == 0:

            print('NO')

            exit()

    if T[i] == 'R' and c < W:

        c += 1



#drop by right

c = C

for i in range(N):

    if S[i] == 'R':

        c += 1

        if c == W + 1:

            print('NO')

            exit()

    if T[i] == 'L' and c > 1:

        c -= 1



print('YES')

H, W, N = [int(_) for _ in input().split()]

R, C = [int(_) for _ in input().split()]

S = eval(input())

T = eval(input())



imin = 1

imax = H

jmin = 1

jmax = W



for n in range(N - 1, -1, -1):

    s = S[n]

    t = T[n]

    if t == 'U':

        imax = min(imax + 1, H)

    elif t == 'D':

        imin = max(imin - 1, 1)

    elif t == 'L':

        jmax = min(jmax + 1, W)

    elif t == 'R':

        jmin = max(jmin - 1, 1)

    if s == 'U':

        imin += 1

    elif s == 'D':

        imax -= 1

    elif s == 'L':

        jmin += 1

    elif s == 'R':

        jmax -= 1

    if imax < imin or jmax < jmin:

        print('NO')

        exit()

if imin <= R <= imax and jmin <= C <= jmax:

    print('YES')

else:

    print('NO')

H, W, N = [int(_) for _ in input().split()]
R, C = [int(_) for _ in input().split()]
S = eval(input())
T = eval(input())
# drop by up
r = R
for i in range(N):
    if S[i] == "U":
        r -= 1
        if r == 0:
            print("NO")
            exit()
    if T[i] == "D" and r < H:
        r += 1
# drop by down
r = R
for i in range(N):
    if S[i] == "D":
        r += 1
        if r == H + 1:
            print("NO")
            exit()
    if T[i] == "U" and r > 1:
        r -= 1
# drop by left
c = C
for i in range(N):
    if S[i] == "L":
        c -= 1
        if c == 0:
            print("NO")
            exit()
    if T[i] == "R" and c < W:
        c += 1
# drop by right
c = C
for i in range(N):
    if S[i] == "R":
        c += 1
        if c == W + 1:
            print("NO")
            exit()
    if T[i] == "L" and c > 1:
        c -= 1
print("YES")

H, W, N = [int(_) for _ in input().split()]
R, C = [int(_) for _ in input().split()]
S = eval(input())
T = eval(input())
imin = 1
imax = H
jmin = 1
jmax = W
for n in range(N - 1, -1, -1):
    s = S[n]
    t = T[n]
    if t == "U":
        imax = min(imax + 1, H)
    elif t == "D":
        imin = max(imin - 1, 1)
    elif t == "L":
        jmax = min(jmax + 1, W)
    elif t == "R":
        jmin = max(jmin - 1, 1)
    if s == "U":
        imin += 1
    elif s == "D":
        imax -= 1
    elif s == "L":
        jmin += 1
    elif s == "R":
        jmax -= 1
    if imax < imin or jmax < jmin:
        print("NO")
        exit()
if imin <= R <= imax and jmin <= C <= jmax:
    print("YES")
else:
    print("NO")

-# drop by up -r = R -for i in range(N): -    if S[i] == "U": -        r -= 1 -        if r == 0: -            print("NO") -            exit() -    if T[i] == "D" and r < H: -        r += 1 -# drop by down -r = R -for i in range(N): -    if S[i] == "D": -        r += 1 -        if r == H + 1: -            print("NO") -            exit() -    if T[i] == "U" and r > 1: -        r -= 1 -# drop by left -c = C -for i in range(N): -    if S[i] == "L": -        c -= 1 -        if c == 0: -            print("NO") -            exit() -    if T[i] == "R" and c < W: -        c += 1 -# drop by right -c = C -for i in range(N): -    if S[i] == "R": -        c += 1 -        if c == W + 1: -            print("NO") -            exit() -    if T[i] == "L" and c > 1: -        c -= 1 -print("YES") +imin = 1 +imax = H +jmin = 1 +jmax = W +for n in range(N - 1, -1, -1): +    s = S[n] +    t = T[n] +    if t == "U": +        imax = min(imax + 1, H) +    elif t == "D": +        imin = max(imin - 1, 1) +    elif t == "L": +        jmax = min(jmax + 1, W) +    elif t == "R": +        jmin = max(jmin - 1, 1) +    if s == "U": +        imin += 1 +    elif s == "D": +        imax -= 1 +    elif s == "L": +        jmin += 1 +    elif s == "R": +        jmax -= 1 +    if imax < imin or jmax < jmin: +        print("NO") +        exit() +if imin <= R <= imax and jmin <= C <= jmax: +    print("YES") +else: +    print("NO")