import bisect

import os

from collections import Counter, deque

from fractions import gcd

from functools import lru_cache

from functools import reduce

import functools

import heapq

import itertools

import math

import numpy as np

import re

import sys



if os.getenv("LOCAL"):

    sys.stdin = open("_in.txt", "r")



sys.setrecursionlimit(2147483647)

INF = float("inf")



S = sys.stdin.readline().rstrip()

T = sys.stdin.readline().rstrip()



a = T + T

ok = False

for i in range(len(S)):

    ok |= a[i:len(S)+i] == S



if ok:

    print('Yes')

else:

    print('No')

import bisect

import cmath

import heapq

import itertools

import math

import operator

import os

import re

import string

import sys

from collections import Counter, deque, defaultdict

from copy import deepcopy

from decimal import Decimal

from fractions import gcd

from functools import lru_cache, reduce

from operator import itemgetter, mul, add, xor



import numpy as np



if os.getenv("LOCAL"):

    sys.stdin = open("_in.txt", "r")



sys.setrecursionlimit(10 ** 9)

INF = float("inf")

IINF = 10 ** 18

MOD = 10 ** 9 + 7

# MOD = 998244353





S = list(sys.stdin.buffer.readline().decode().rstrip())

T = list(sys.stdin.buffer.readline().decode().rstrip())



S = np.array(S, dtype=str)

T = np.array(T, dtype=str)





ok=False

for _ in range(len(S)):

    S = np.roll(S, 1)

    ok |= np.all(S == T)

if ok:

    print('Yes')

else:

    print('No')





import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
S = sys.stdin.readline().rstrip()
T = sys.stdin.readline().rstrip()
a = T + T
ok = False
for i in range(len(S)):
    ok |= a[i : len(S) + i] == S
if ok:
    print("Yes")
else:
    print("No")

import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor
import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
S = list(sys.stdin.buffer.readline().decode().rstrip())
T = list(sys.stdin.buffer.readline().decode().rstrip())
S = np.array(S, dtype=str)
T = np.array(T, dtype=str)
ok = False
for _ in range(len(S)):
    S = np.roll(S, 1)
    ok |= np.all(S == T)
if ok:
    print("Yes")
else:
    print("No")

-import os -from collections import Counter, deque -from fractions import gcd -from functools import lru_cache -from functools import reduce -import functools +import cmath +import operator +import os +import re +import string +import sys +from collections import Counter, deque, defaultdict +from copy import deepcopy +from decimal import Decimal +from fractions import gcd +from functools import lru_cache, reduce +from operator import itemgetter, mul, add, xor -import re -import sys -sys.setrecursionlimit(2147483647) +sys.setrecursionlimit(10**9) -S = sys.stdin.readline().rstrip() -T = sys.stdin.readline().rstrip() -a = T + T +IINF = 10**18 +MOD = 10**9 + 7 +# MOD = 998244353 +S = list(sys.stdin.buffer.readline().decode().rstrip()) +T = list(sys.stdin.buffer.readline().decode().rstrip()) +S = np.array(S, dtype=str) +T = np.array(T, dtype=str) -for i in range(len(S)): -    ok |= a[i : len(S) + i] == S +for _ in range(len(S)): +    S = np.roll(S, 1) +    ok |= np.all(S == T)