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

/**
 * Lesson8D 図のようなリング状の文字列 s の任意の位置から、 時計回りに連続した文字をいくつか選んで、 文字列 p が作れるかを判定するプログラム
 * 
 * @author Internship
 * 
 */
public class Main{

	/**
	 * プログラムのエントリポイント
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		// 1行読み込む
		try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			String strLine = insBR.readLine();

			// char型に分解 文字列s
			char[] chaAryLineS = strLine.toCharArray();

			char[] chaAryLineSAfter = new char[chaAryLineS.length * 2];

			strLine = insBR.readLine();

			// char型に分解 文字列p
			char[] chaAryLineP = strLine.toCharArray();

			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length);
			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length);

			// 終了条件
			int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1;

			int intCount = 0;

			boolean booYes = false;

			for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			}

			if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (IOException e) {
			System.out.println(e);
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{

	/**
	 * プログラムのエントリポイント
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		// 1行読み込む
		try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			String strLine = insBR.readLine();

			// char型に分解 文字列s
			char[] chaAryLineS = strLine.toCharArray();

			char[] chaAryLineSAfter = new char[chaAryLineS.length * 2];

			strLine = insBR.readLine();

			// char型に分解 文字列p
			char[] chaAryLineP = strLine.toCharArray();

			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length);
			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length);

			// 終了条件
			int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1;

			int intCount = 0;

			boolean booYes = false;

			for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			}

			if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (IOException e) {
			System.out.println(e);
		}
	}
} Main /**
	 * プログラムのエントリポイント
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		// 1行読み込む
		try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			String strLine = insBR.readLine();

			// char型に分解 文字列s
			char[] chaAryLineS = strLine.toCharArray();

			char[] chaAryLineSAfter = new char[chaAryLineS.length * 2];

			strLine = insBR.readLine();

			// char型に分解 文字列p
			char[] chaAryLineP = strLine.toCharArray();

			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length);
			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length);

			// 終了条件
			int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1;

			int intCount = 0;

			boolean booYes = false;

			for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			}

			if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (IOException e) {
			System.out.println(e);
		}
	} main {

		// 1行読み込む
		try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			String strLine = insBR.readLine();

			// char型に分解 文字列s
			char[] chaAryLineS = strLine.toCharArray();

			char[] chaAryLineSAfter = new char[chaAryLineS.length * 2];

			strLine = insBR.readLine();

			// char型に分解 文字列p
			char[] chaAryLineP = strLine.toCharArray();

			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length);
			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length);

			// 終了条件
			int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1;

			int intCount = 0;

			boolean booYes = false;

			for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			}

			if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (IOException e) {
			System.out.println(e);
		}
	} try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			String strLine = insBR.readLine();

			// char型に分解 文字列s
			char[] chaAryLineS = strLine.toCharArray();

			char[] chaAryLineSAfter = new char[chaAryLineS.length * 2];

			strLine = insBR.readLine();

			// char型に分解 文字列p
			char[] chaAryLineP = strLine.toCharArray();

			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length);
			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length);

			// 終了条件
			int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1;

			int intCount = 0;

			boolean booYes = false;

			for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			}

			if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (IOException e) {
			System.out.println(e);
		} catch (IOException e) {
			System.out.println(e);
		} IOException e {
			System.out.println(e);
		} System.out.println(e) System.out.println System.out System System.out e {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			String strLine = insBR.readLine();

			// char型に分解 文字列s
			char[] chaAryLineS = strLine.toCharArray();

			char[] chaAryLineSAfter = new char[chaAryLineS.length * 2];

			strLine = insBR.readLine();

			// char型に分解 文字列p
			char[] chaAryLineP = strLine.toCharArray();

			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length);
			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length);

			// 終了条件
			int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1;

			int intCount = 0;

			boolean booYes = false;

			for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			}

			if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in)); insBR new BufferedReader(new InputStreamReader(
					System.in)) String strLine = insBR.readLine(); strLine insBR.readLine() insBR.readLine insBR char[] chaAryLineS = strLine.toCharArray(); chaAryLineS strLine.toCharArray() strLine.toCharArray strLine char[] chaAryLineSAfter = new char[chaAryLineS.length * 2]; chaAryLineSAfter new char[chaAryLineS.length * 2] chaAryLineS.length * 2 chaAryLineS.length chaAryLineS chaAryLineS.length 2 strLine = insBR.readLine() strLine insBR.readLine() insBR.readLine insBR char[] chaAryLineP = strLine.toCharArray(); chaAryLineP strLine.toCharArray() strLine.toCharArray strLine System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length) System.arraycopy System chaAryLineS 0 chaAryLineSAfter 0 chaAryLineS.length chaAryLineS chaAryLineS.length System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length) System.arraycopy System chaAryLineS 0 chaAryLineSAfter chaAryLineS.length chaAryLineS chaAryLineS.length chaAryLineS.length chaAryLineS chaAryLineS.length int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1; intlength chaAryLineSAfter.length - chaAryLineP.length + 1 chaAryLineSAfter.length - chaAryLineP.length chaAryLineSAfter.length chaAryLineSAfter chaAryLineSAfter.length chaAryLineP.length chaAryLineP chaAryLineP.length 1 int intCount = 0; intCount 0 boolean booYes = false; booYes false for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			} int i = 0; int i = 0; i 0 i < intlength i intlength i++ i++ i {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			} {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			} for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				} int j = 0; int j = 0; j 0 j < chaAryLineP.length j chaAryLineP.length chaAryLineP chaAryLineP.length j++ j++ j {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				} {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				} if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					} chaAryLineSAfter[i + j] == chaAryLineP[j] chaAryLineSAfter[i + j] chaAryLineSAfter i + j i j chaAryLineP[j] chaAryLineP j {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					} intCount++ intCount if (intCount == chaAryLineP.length) {
							booYes = true;
						} intCount == chaAryLineP.length intCount chaAryLineP.length chaAryLineP chaAryLineP.length {
							booYes = true;
						} booYes = true booYes true intCount = 0 intCount 0 if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			} booYes {
				System.out.println("Yes");
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
				System.out.println("No");
			} System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main{

	/**
	 * プログラムのエントリポイント
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		// 1行読み込む
		try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			String strLine = insBR.readLine();

			// char型に分解 文字列s
			char[] chaAryLineS = strLine.toCharArray();

			char[] chaAryLineSAfter = new char[chaAryLineS.length * 2];

			strLine = insBR.readLine();

			// char型に分解 文字列p
			char[] chaAryLineP = strLine.toCharArray();

			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length);
			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length);

			// 終了条件
			int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1;

			int intCount = 0;

			boolean booYes = false;

			for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			}

			if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (IOException e) {
			System.out.println(e);
		}
	}
} public class Main{

	/**
	 * プログラムのエントリポイント
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		// 1行読み込む
		try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			String strLine = insBR.readLine();

			// char型に分解 文字列s
			char[] chaAryLineS = strLine.toCharArray();

			char[] chaAryLineSAfter = new char[chaAryLineS.length * 2];

			strLine = insBR.readLine();

			// char型に分解 文字列p
			char[] chaAryLineP = strLine.toCharArray();

			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length);
			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length);

			// 終了条件
			int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1;

			int intCount = 0;

			boolean booYes = false;

			for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			}

			if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (IOException e) {
			System.out.println(e);
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Lesson8D 図のようなリング状の文字列 s の任意の位置から、 時計回りに連続した文字をいくつか選んで、 文字列 p が作れるかを判定するプログラム
 * 
 * @author Internship
 * 
 */
public class Main{

	/**
	 * プログラムのエントリポイント
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		// 1行読み込む
		try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			String strLine = insBR.readLine();

			// char型に分解 文字列s
			char[] chaAryLineS = strLine.toCharArray();

			char[] chaAryLineSAfter = new char[chaAryLineS.length * 2];

			strLine = insBR.readLine();

			// char型に分解 文字列p
			char[] chaAryLineP = strLine.toCharArray();

			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length);
			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length);

			// 終了条件
			int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1;

			int intCount = 0;

			boolean booYes = false;

			for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			}

			if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (IOException e) {
			System.out.println(e);
		}
	}
}