s = eval(input())

p = eval(input())

s *= 2

if p in s:

    print('Yes')

else:

    print('No')
s = eval(input()) * 2

p = eval(input())

if p in s:

    print('Yes')

else:

    print('No')



s = eval(input())
p = eval(input())
s *= 2
if p in s:
    print("Yes")
else:
    print("No")

s = eval(input()) * 2
p = eval(input())
if p in s:
    print("Yes")
else:
    print("No")

-s = eval(input()) +s = eval(input()) * 2 -s *= 2