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

sr, sc = list(map(int, input().split()))

S = eval(input())

T = eval(input())

 

up = [0] * (N+1)

down = [0] * (N+1)

right = [0] * (N+1)

left = [0] * (N+1)

maxU, maxD, maxR, maxL = 0, 0, 0, 0

 

for i in range(N):

    if S[i] == "L":

        left[i+1] = left[i] + 1

        right[i+1] = right[i]

        up[i+1] = up[i]

        down[i+1] = down[i]

        maxL = max(maxL, left[i+1])

    elif S[i] == "R":

        right[i+1] = right[i] + 1

        up[i+1] = up[i]

        down[i+1] = down[i]

        left[i+1]  = left[i]

        maxR = max(maxR, right[i+1])

    elif S[i] == "U":

        up[i+1] = up[i] + 1

        right[i+1] = right[i]

        down[i+1] = down[i]

        left[i+1]  = left[i]

        maxU = max(maxU, up[i+1])

    else:

        down[i+1] = down[i] + 1

        right[i+1] = right[i]

        up[i+1] = up[i]

        left[i+1]  = left[i]

        maxD = max(maxD, down[i+1])

    if T[i] == "L":

        right[i+1] = max(right[i+1] - 1, -sc + 1)

    elif T[i] == "R":

        left[i+1] = max(left[i+1] - 1, sc - W)

    elif T[i] == "U":

        down[i+1] = max(down[i+1] - 1, -sr + 1)

    else:

        up[i+1] = max(up[i+1] - 1, sr - H)

 

if sr + maxD > H or sr - maxU <= 0 or sc + maxR > W or sc - maxL <= 0:

    print("NO")

else:  print("YES")





import sys



def solve():

    input = sys.stdin.readline

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

    s, r = list(map(int, input().split()))

    S = input().strip("\n")

    T = input().strip("\n")

    Lb, Rb, Ub, Db = -1, W, -1, H

    for i in reversed(list(range(N))):

        if i != N - 1:

            if T[i] == "L": Rb = min(Rb + 1, W)

            elif T[i] == "R": Lb = max(Lb - 1, -1)

            elif T[i] == "U": Db = min(Db + 1, H)

            elif T[i] == "D": Ub = max(Ub - 1, 0)



        if S[i] == "L": Lb = Lb + 1

        elif S[i] == "R": Rb = Rb - 1

        elif S[i] == "U": Ub = Ub + 1

        elif S[i] == "D": Db = Db - 1



        if Lb >= W - 1 or Rb <= 0 or Ub >= H - 1 or Db <= 0:

            print("NO")

            break

    else:

        if Lb < r - 1 < Rb and Ub < s - 1 < Db: print("YES")

        else: print("NO")

    

    #print(Lb, Rb, Ub, Db)



    return 0



if __name__ == "__main__":

    solve()
H, W, N = list(map(int, input().split()))
sr, sc = list(map(int, input().split()))
S = eval(input())
T = eval(input())
up = [0] * (N + 1)
down = [0] * (N + 1)
right = [0] * (N + 1)
left = [0] * (N + 1)
maxU, maxD, maxR, maxL = 0, 0, 0, 0
for i in range(N):
    if S[i] == "L":
        left[i + 1] = left[i] + 1
        right[i + 1] = right[i]
        up[i + 1] = up[i]
        down[i + 1] = down[i]
        maxL = max(maxL, left[i + 1])
    elif S[i] == "R":
        right[i + 1] = right[i] + 1
        up[i + 1] = up[i]
        down[i + 1] = down[i]
        left[i + 1] = left[i]
        maxR = max(maxR, right[i + 1])
    elif S[i] == "U":
        up[i + 1] = up[i] + 1
        right[i + 1] = right[i]
        down[i + 1] = down[i]
        left[i + 1] = left[i]
        maxU = max(maxU, up[i + 1])
    else:
        down[i + 1] = down[i] + 1
        right[i + 1] = right[i]
        up[i + 1] = up[i]
        left[i + 1] = left[i]
        maxD = max(maxD, down[i + 1])
    if T[i] == "L":
        right[i + 1] = max(right[i + 1] - 1, -sc + 1)
    elif T[i] == "R":
        left[i + 1] = max(left[i + 1] - 1, sc - W)
    elif T[i] == "U":
        down[i + 1] = max(down[i + 1] - 1, -sr + 1)
    else:
        up[i + 1] = max(up[i + 1] - 1, sr - H)
if sr + maxD > H or sr - maxU <= 0 or sc + maxR > W or sc - maxL <= 0:
    print("NO")
else:
    print("YES")

import sys


def solve():
    input = sys.stdin.readline
    H, W, N = list(map(int, input().split()))
    s, r = list(map(int, input().split()))
    S = input().strip("\n")
    T = input().strip("\n")
    Lb, Rb, Ub, Db = -1, W, -1, H
    for i in reversed(list(range(N))):
        if i != N - 1:
            if T[i] == "L":
                Rb = min(Rb + 1, W)
            elif T[i] == "R":
                Lb = max(Lb - 1, -1)
            elif T[i] == "U":
                Db = min(Db + 1, H)
            elif T[i] == "D":
                Ub = max(Ub - 1, 0)
        if S[i] == "L":
            Lb = Lb + 1
        elif S[i] == "R":
            Rb = Rb - 1
        elif S[i] == "U":
            Ub = Ub + 1
        elif S[i] == "D":
            Db = Db - 1
        if Lb >= W - 1 or Rb <= 0 or Ub >= H - 1 or Db <= 0:
            print("NO")
            break
    else:
        if Lb < r - 1 < Rb and Ub < s - 1 < Db:
            print("YES")
        else:
            print("NO")
    # print(Lb, Rb, Ub, Db)
    return 0


if __name__ == "__main__":
    solve()

-H, W, N = list(map(int, input().split())) -sr, sc = list(map(int, input().split())) -S = eval(input()) -T = eval(input()) -up = [0] * (N + 1) -down = [0] * (N + 1) -right = [0] * (N + 1) -left = [0] * (N + 1) -maxU, maxD, maxR, maxL = 0, 0, 0, 0 -for i in range(N): -    if S[i] == "L": -        left[i + 1] = left[i] + 1 -        right[i + 1] = right[i] -        up[i + 1] = up[i] -        down[i + 1] = down[i] -        maxL = max(maxL, left[i + 1]) -    elif S[i] == "R": -        right[i + 1] = right[i] + 1 -        up[i + 1] = up[i] -        down[i + 1] = down[i] -        left[i + 1] = left[i] -        maxR = max(maxR, right[i + 1]) -    elif S[i] == "U": -        up[i + 1] = up[i] + 1 -        right[i + 1] = right[i] -        down[i + 1] = down[i] -        left[i + 1] = left[i] -        maxU = max(maxU, up[i + 1]) +import sys + + +def solve(): +    input = sys.stdin.readline +    H, W, N = list(map(int, input().split())) +    s, r = list(map(int, input().split())) +    S = input().strip("\n") +    T = input().strip("\n") +    Lb, Rb, Ub, Db = -1, W, -1, H +    for i in reversed(list(range(N))): +        if i != N - 1: +            if T[i] == "L": +                Rb = min(Rb + 1, W) +            elif T[i] == "R": +                Lb = max(Lb - 1, -1) +            elif T[i] == "U": +                Db = min(Db + 1, H) +            elif T[i] == "D": +                Ub = max(Ub - 1, 0) +        if S[i] == "L": +            Lb = Lb + 1 +        elif S[i] == "R": +            Rb = Rb - 1 +        elif S[i] == "U": +            Ub = Ub + 1 +        elif S[i] == "D": +            Db = Db - 1 +        if Lb >= W - 1 or Rb <= 0 or Ub >= H - 1 or Db <= 0: +            print("NO") +            break -        down[i + 1] = down[i] + 1 -        right[i + 1] = right[i] -        up[i + 1] = up[i] -        left[i + 1] = left[i] -        maxD = max(maxD, down[i + 1]) -    if T[i] == "L": -        right[i + 1] = max(right[i + 1] - 1, -sc + 1) -    elif T[i] == "R": -        left[i + 1] = max(left[i + 1] - 1, sc - W) -    elif T[i] == "U": -        down[i + 1] = max(down[i + 1] - 1, -sr + 1) -    else: -        up[i + 1] = max(up[i + 1] - 1, sr - H) -if sr + maxD > H or sr - maxU <= 0 or sc + maxR > W or sc - maxL <= 0: -    print("NO") -else: -    print("YES") +        if Lb < r - 1 < Rb and Ub < s - 1 < Db: +            print("YES") +        else: +            print("NO") +    # print(Lb, Rb, Ub, Db) +    return 0 + + +if __name__ == "__main__": +    solve()