import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		//System.out.print(" ");
		Scanner scan = new Scanner(System.in);
		String ring =scan.nextLine();
		String kadai =scan.nextLine();
		char[] moji = ring.toCharArray();
		int kadainagasa = kadai.length();
		String hikaku = "";
		int hikakunagasa = ring.length();
		int kai = 0;
		for(int i=0; i<hikakunagasa; i++){
				hikaku = "";
				kai = 0;
				for(int ii=0; ii<kadainagasa; ii++){
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				}
//				System.out.println(hikaku);
				if(kadai.equals(hikaku)){
					System.out.println("Yes");
					kai = 1;
					break;
				}
		}
		if(kai == 0){
			System.out.println("No");
		}
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		//System.out.print(" ");
		Scanner scan = new Scanner(System.in);
		String ring =scan.nextLine();
		String kadai =scan.nextLine();
		char[] moji = ring.toCharArray();
		int kadainagasa = kadai.length();
		String hikaku = "";
		int hikakunagasa = ring.length();
		int kai = 0;
		for(int i=0; i<hikakunagasa; i++){
				hikaku = "";
				kai = 0;
				for(int ii=0; ii<kadainagasa; ii++){
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				}
//				System.out.println(hikaku);
				if(kadai.equals(hikaku)){
					System.out.println("Yes");
					kai = 1;
					break;
				}
		}
		if(kai == 0){
			System.out.println("No");
		}
	}
} Main public static void main(String[] args)throws NumberFormatException, IOException{
		//System.out.print(" ");
		Scanner scan = new Scanner(System.in);
		String ring =scan.nextLine();
		String kadai =scan.nextLine();
		char[] moji = ring.toCharArray();
		int kadainagasa = kadai.length();
		String hikaku = "";
		int hikakunagasa = ring.length();
		int kai = 0;
		for(int i=0; i<hikakunagasa; i++){
				hikaku = "";
				kai = 0;
				for(int ii=0; ii<kadainagasa; ii++){
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				}
//				System.out.println(hikaku);
				if(kadai.equals(hikaku)){
					System.out.println("Yes");
					kai = 1;
					break;
				}
		}
		if(kai == 0){
			System.out.println("No");
		}
	} main {
		//System.out.print(" ");
		Scanner scan = new Scanner(System.in);
		String ring =scan.nextLine();
		String kadai =scan.nextLine();
		char[] moji = ring.toCharArray();
		int kadainagasa = kadai.length();
		String hikaku = "";
		int hikakunagasa = ring.length();
		int kai = 0;
		for(int i=0; i<hikakunagasa; i++){
				hikaku = "";
				kai = 0;
				for(int ii=0; ii<kadainagasa; ii++){
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				}
//				System.out.println(hikaku);
				if(kadai.equals(hikaku)){
					System.out.println("Yes");
					kai = 1;
					break;
				}
		}
		if(kai == 0){
			System.out.println("No");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String ring =scan.nextLine(); ring scan.nextLine() scan.nextLine scan String kadai =scan.nextLine(); kadai scan.nextLine() scan.nextLine scan char[] moji = ring.toCharArray(); moji ring.toCharArray() ring.toCharArray ring int kadainagasa = kadai.length(); kadainagasa kadai.length() kadai.length kadai String hikaku = ""; hikaku "" int hikakunagasa = ring.length(); hikakunagasa ring.length() ring.length ring int kai = 0; kai 0 for(int i=0; i<hikakunagasa; i++){
				hikaku = "";
				kai = 0;
				for(int ii=0; ii<kadainagasa; ii++){
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				}
//				System.out.println(hikaku);
				if(kadai.equals(hikaku)){
					System.out.println("Yes");
					kai = 1;
					break;
				}
		} int i=0; int i=0; i 0 i<hikakunagasa i hikakunagasa i++ i++ i {
				hikaku = "";
				kai = 0;
				for(int ii=0; ii<kadainagasa; ii++){
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				}
//				System.out.println(hikaku);
				if(kadai.equals(hikaku)){
					System.out.println("Yes");
					kai = 1;
					break;
				}
		} {
				hikaku = "";
				kai = 0;
				for(int ii=0; ii<kadainagasa; ii++){
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				}
//				System.out.println(hikaku);
				if(kadai.equals(hikaku)){
					System.out.println("Yes");
					kai = 1;
					break;
				}
		} hikaku = "" hikaku "" kai = 0 kai 0 for(int ii=0; ii<kadainagasa; ii++){
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				} int ii=0; int ii=0; ii 0 ii<kadainagasa ii kadainagasa ii++ ii++ ii {
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				} {
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				} int i2 = ii; i2 ii if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					} i + i2 >= hikakunagasa i + i2 i i2 hikakunagasa {
						i2 -= hikakunagasa;
					} i2 -= hikakunagasa i2 hikakunagasa hikaku = hikaku + moji[i+i2] hikaku hikaku + moji[i+i2] hikaku moji[i+i2] moji i+i2 i i2 if(kadai.equals(hikaku)){
					System.out.println("Yes");
					kai = 1;
					break;
				} kadai.equals(hikaku) kadai.equals kadai hikaku {
					System.out.println("Yes");
					kai = 1;
					break;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" kai = 1 kai 1 break; if(kai == 0){
			System.out.println("No");
		} kai == 0 kai 0 {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		//System.out.print(" ");
		Scanner scan = new Scanner(System.in);
		String ring =scan.nextLine();
		String kadai =scan.nextLine();
		char[] moji = ring.toCharArray();
		int kadainagasa = kadai.length();
		String hikaku = "";
		int hikakunagasa = ring.length();
		int kai = 0;
		for(int i=0; i<hikakunagasa; i++){
				hikaku = "";
				kai = 0;
				for(int ii=0; ii<kadainagasa; ii++){
					int i2 = ii;
					if(i + i2 >= hikakunagasa){
						i2 -= hikakunagasa;
					}
					hikaku = hikaku + moji[i+i2];
				}
//				System.out.println(hikaku);
				if(kadai.equals(hikaku)){
					System.out.println("Yes");
					kai = 1;
					break;
				}
		}
		if(kai == 0){
			System.out.println("No");
		}
	}
}