import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main (String[] args) throws IOException
	{
		BufferedReader input = new BufferedReader (new InputStreamReader (System.in));

		String str = input.readLine();

		String want = input.readLine();

		boolean judge = false;

		if(want.length() == 1)
		{
			//入力した文字があるか判定
			for(int num = 0; num < str.length(); num++)
			{
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			}
		}

		else
		{
			//入力した文字列が作れるか判定
			for(int start = 0; start < str.length(); start++)
			{
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			}
		}

		if(judge)
			System.out.println("Yes");

		else
			System.out.println("No");
	}
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main (String[] args) throws IOException
	{
		BufferedReader input = new BufferedReader (new InputStreamReader (System.in));

		String str = input.readLine();

		String want = input.readLine();

		boolean judge = false;

		if(want.length() == 1)
		{
			//入力した文字があるか判定
			for(int num = 0; num < str.length(); num++)
			{
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			}
		}

		else
		{
			//入力した文字列が作れるか判定
			for(int start = 0; start < str.length(); start++)
			{
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			}
		}

		if(judge)
			System.out.println("Yes");

		else
			System.out.println("No");
	}
} Main public static void main (String[] args) throws IOException
	{
		BufferedReader input = new BufferedReader (new InputStreamReader (System.in));

		String str = input.readLine();

		String want = input.readLine();

		boolean judge = false;

		if(want.length() == 1)
		{
			//入力した文字があるか判定
			for(int num = 0; num < str.length(); num++)
			{
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			}
		}

		else
		{
			//入力した文字列が作れるか判定
			for(int start = 0; start < str.length(); start++)
			{
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			}
		}

		if(judge)
			System.out.println("Yes");

		else
			System.out.println("No");
	} main {
		BufferedReader input = new BufferedReader (new InputStreamReader (System.in));

		String str = input.readLine();

		String want = input.readLine();

		boolean judge = false;

		if(want.length() == 1)
		{
			//入力した文字があるか判定
			for(int num = 0; num < str.length(); num++)
			{
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			}
		}

		else
		{
			//入力した文字列が作れるか判定
			for(int start = 0; start < str.length(); start++)
			{
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			}
		}

		if(judge)
			System.out.println("Yes");

		else
			System.out.println("No");
	} BufferedReader input = new BufferedReader (new InputStreamReader (System.in)); input new BufferedReader (new InputStreamReader (System.in)) String str = input.readLine(); str input.readLine() input.readLine input String want = input.readLine(); want input.readLine() input.readLine input boolean judge = false; judge false if(want.length() == 1)
		{
			//入力した文字があるか判定
			for(int num = 0; num < str.length(); num++)
			{
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			}
		}

		else
		{
			//入力した文字列が作れるか判定
			for(int start = 0; start < str.length(); start++)
			{
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			}
		} want.length() == 1 want.length() want.length want 1 {
			//入力した文字があるか判定
			for(int num = 0; num < str.length(); num++)
			{
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			}
		} for(int num = 0; num < str.length(); num++)
			{
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			} int num = 0; int num = 0; num 0 num < str.length() num str.length() str.length str num++ num++ num {
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			} {
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			} if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				} str.charAt(num) == want.charAt(0) str.charAt(num) str.charAt str num want.charAt(0) want.charAt want 0 {
					judge = true;
					break;
				} judge = true judge true break; {
			//入力した文字列が作れるか判定
			for(int start = 0; start < str.length(); start++)
			{
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			}
		} for(int start = 0; start < str.length(); start++)
			{
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			} int start = 0; int start = 0; start 0 start < str.length() start str.length() str.length str start++ start++ start {
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			} {
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			} if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				} str.charAt(start) == want.charAt(0) str.charAt(start) str.charAt str start want.charAt(0) want.charAt want 0 {
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				} for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					} int next = 1; int next = 1; next 1 next < want.length() next want.length() want.length want next++ next++ next {
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					} {
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					} if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						} next + start < str.length() next + start next start str.length() str.length str {
							if(str.charAt(next + start) != want.charAt(next))
								break;
						} if(str.charAt(next + start) != want.charAt(next))
								break; str.charAt(next + start) != want.charAt(next) str.charAt(next + start) str.charAt str next + start next start want.charAt(next) want.charAt want next break; if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						} next + start >= str.length() next + start next start str.length() str.length str {
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						} if(str.charAt(next + start - str.length()) != want.charAt(next))
								break; str.charAt(next + start - str.length()) != want.charAt(next) str.charAt(next + start - str.length()) str.charAt str next + start - str.length() next + start next start str.length() str.length str want.charAt(next) want.charAt want next break; if(next + 1 == want.length())
							judge = true; next + 1 == want.length() next + 1 next 1 want.length() want.length want judge = true judge true if(judge)
			System.out.println("Yes");

		else
			System.out.println("No"); judge System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
	public static void main (String[] args) throws IOException
	{
		BufferedReader input = new BufferedReader (new InputStreamReader (System.in));

		String str = input.readLine();

		String want = input.readLine();

		boolean judge = false;

		if(want.length() == 1)
		{
			//入力した文字があるか判定
			for(int num = 0; num < str.length(); num++)
			{
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			}
		}

		else
		{
			//入力した文字列が作れるか判定
			for(int start = 0; start < str.length(); start++)
			{
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			}
		}

		if(judge)
			System.out.println("Yes");

		else
			System.out.println("No");
	}
} public class Main {
	public static void main (String[] args) throws IOException
	{
		BufferedReader input = new BufferedReader (new InputStreamReader (System.in));

		String str = input.readLine();

		String want = input.readLine();

		boolean judge = false;

		if(want.length() == 1)
		{
			//入力した文字があるか判定
			for(int num = 0; num < str.length(); num++)
			{
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			}
		}

		else
		{
			//入力した文字列が作れるか判定
			for(int start = 0; start < str.length(); start++)
			{
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			}
		}

		if(judge)
			System.out.println("Yes");

		else
			System.out.println("No");
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main (String[] args) throws IOException
	{
		BufferedReader input = new BufferedReader (new InputStreamReader (System.in));

		String str = input.readLine();

		String want = input.readLine();

		boolean judge = false;

		if(want.length() == 1)
		{
			//入力した文字があるか判定
			for(int num = 0; num < str.length(); num++)
			{
				if(str.charAt(num) == want.charAt(0))
				{
					judge = true;
					break;
				}
			}
		}

		else
		{
			//入力した文字列が作れるか判定
			for(int start = 0; start < str.length(); start++)
			{
				if(str.charAt(start) == want.charAt(0))
				{
					//2文字以降の判定
					for(int next = 1; next < want.length(); next++)
					{
						//繋ぎ目を越える前
						if(next + start < str.length())
						{
							if(str.charAt(next + start) != want.charAt(next))
								break;
						}

						//繋ぎ目を超えた後
						else if(next + start >= str.length())
						{
							if(str.charAt(next + start - str.length()) != want.charAt(next))
								break;
						}

						//入力した文字列が作れた場合
						if(next + 1 == want.length())
							judge = true;
					}
				}
			}
		}

		if(judge)
			System.out.println("Yes");

		else
			System.out.println("No");
	}
}

