import java.util.Scanner;

// import java.util.ArrayList;
// import java.util.List;
// import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		char[] sC = s.toCharArray();
		char[] pC = p.toCharArray();
		for (int i = 0; i < sC.length; i++) {
			if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

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

}
 import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		char[] sC = s.toCharArray();
		char[] pC = p.toCharArray();
		for (int i = 0; i < sC.length; i++) {
			if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

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

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		char[] sC = s.toCharArray();
		char[] pC = p.toCharArray();
		for (int i = 0; i < sC.length; i++) {
			if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

			}
		}
		System.out.println("No");
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		char[] sC = s.toCharArray();
		char[] pC = p.toCharArray();
		for (int i = 0; i < sC.length; i++) {
			if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

			}
		}
		System.out.println("No");
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.nextLine(); s scan.nextLine() scan.nextLine scan String p = scan.nextLine(); p scan.nextLine() scan.nextLine scan char[] sC = s.toCharArray(); sC s.toCharArray() s.toCharArray s char[] pC = p.toCharArray(); pC p.toCharArray() p.toCharArray p for (int i = 0; i < sC.length; i++) {
			if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

			}
		} int i = 0; int i = 0; i 0 i < sC.length i sC.length sC sC.length i++ i++ i {
			if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

			}
		} {
			if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

			}
		} if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

			} pC[0] == sC[i] pC[0] pC 0 sC[i] sC i {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

			} int cnt = 0; cnt 0 for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				} int j = 0; int j = 0; j 0 j < p.length() j p.length() p.length p j++ j++ j {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				} {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				} if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					} pC[j] == sC[(i + j) % s.length()] pC[j] pC j sC[(i + j) % s.length()] sC (i + j) % s.length() (i + j) i j s.length() s.length s {
					cnt ++;
					} cnt ++ cnt {
					break;
					} break; if(p.length() == cnt){
					System.out.println("Yes");
					return;
					} p.length() == cnt p.length() p.length p cnt {
					System.out.println("Yes");
					return;
					} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		char[] sC = s.toCharArray();
		char[] pC = p.toCharArray();
		for (int i = 0; i < sC.length; i++) {
			if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

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

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		char[] sC = s.toCharArray();
		char[] pC = p.toCharArray();
		for (int i = 0; i < sC.length; i++) {
			if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

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

} Main
import java.util.Scanner;

// import java.util.ArrayList;
// import java.util.List;
// import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		char[] sC = s.toCharArray();
		char[] pC = p.toCharArray();
		for (int i = 0; i < sC.length; i++) {
			if (pC[0] == sC[i]) {
				int cnt = 0;
				for (int j = 0; j < p.length(); j++) {
					if(pC[j] == sC[(i + j) % s.length()]){
					cnt ++;
					}else{
					break;
					}
					if(p.length() == cnt){
					System.out.println("Yes");
					return;
					}
				}

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

}

