import java.util.Scanner;

class Main
{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
	
	int a = 0;
	int tas = 0;;
	int q;
	int i;
	int z;
	int j = 0;
	int b = 0;
	
	String Bun = scan.nextLine();
	String Miz = scan.nextLine();
	
	Bun = Bun + Bun;
	
	char[] bun = Bun.toCharArray();
	char[] miz = Miz.toCharArray();
		
	for(q=0; q<miz.length; q++){
	}
		
	for(z=0; z<bun.length; z++){
	}
		
	int x = z - q;
	
	for(i=0; i<x; i++){
		if(bun[i]==miz[j]){
			for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }}
		}
		if(b==1){
			break;}
	}
		if(a==1){	
			System.out.println("Yes");}
		else{
			System.out.println("No");}
	}
} import java.util.Scanner; Scanner java.util class Main
{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
	
	int a = 0;
	int tas = 0;;
	int q;
	int i;
	int z;
	int j = 0;
	int b = 0;
	
	String Bun = scan.nextLine();
	String Miz = scan.nextLine();
	
	Bun = Bun + Bun;
	
	char[] bun = Bun.toCharArray();
	char[] miz = Miz.toCharArray();
		
	for(q=0; q<miz.length; q++){
	}
		
	for(z=0; z<bun.length; z++){
	}
		
	int x = z - q;
	
	for(i=0; i<x; i++){
		if(bun[i]==miz[j]){
			for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }}
		}
		if(b==1){
			break;}
	}
		if(a==1){	
			System.out.println("Yes");}
		else{
			System.out.println("No");}
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
	
	int a = 0;
	int tas = 0;;
	int q;
	int i;
	int z;
	int j = 0;
	int b = 0;
	
	String Bun = scan.nextLine();
	String Miz = scan.nextLine();
	
	Bun = Bun + Bun;
	
	char[] bun = Bun.toCharArray();
	char[] miz = Miz.toCharArray();
		
	for(q=0; q<miz.length; q++){
	}
		
	for(z=0; z<bun.length; z++){
	}
		
	int x = z - q;
	
	for(i=0; i<x; i++){
		if(bun[i]==miz[j]){
			for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }}
		}
		if(b==1){
			break;}
	}
		if(a==1){	
			System.out.println("Yes");}
		else{
			System.out.println("No");}
	} main {
		Scanner scan = new Scanner(System.in);
	
	int a = 0;
	int tas = 0;;
	int q;
	int i;
	int z;
	int j = 0;
	int b = 0;
	
	String Bun = scan.nextLine();
	String Miz = scan.nextLine();
	
	Bun = Bun + Bun;
	
	char[] bun = Bun.toCharArray();
	char[] miz = Miz.toCharArray();
		
	for(q=0; q<miz.length; q++){
	}
		
	for(z=0; z<bun.length; z++){
	}
		
	int x = z - q;
	
	for(i=0; i<x; i++){
		if(bun[i]==miz[j]){
			for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }}
		}
		if(b==1){
			break;}
	}
		if(a==1){	
			System.out.println("Yes");}
		else{
			System.out.println("No");}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a = 0; a 0 int tas = 0; tas 0 int q; q int i; i int z; z int j = 0; j 0 int b = 0; b 0 String Bun = scan.nextLine(); Bun scan.nextLine() scan.nextLine scan String Miz = scan.nextLine(); Miz scan.nextLine() scan.nextLine scan Bun = Bun + Bun Bun Bun + Bun Bun Bun char[] bun = Bun.toCharArray(); bun Bun.toCharArray() Bun.toCharArray Bun char[] miz = Miz.toCharArray(); miz Miz.toCharArray() Miz.toCharArray Miz for(q=0; q<miz.length; q++){
	} q=0; q=0 q 0 q<miz.length q miz.length miz miz.length q++ q++ q {
	} {
	} for(z=0; z<bun.length; z++){
	} z=0; z=0 z 0 z<bun.length z bun.length bun bun.length z++ z++ z {
	} {
	} int x = z - q; x z - q z q for(i=0; i<x; i++){
		if(bun[i]==miz[j]){
			for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }}
		}
		if(b==1){
			break;}
	} i=0; i=0 i 0 i<x i x i++ i++ i {
		if(bun[i]==miz[j]){
			for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }}
		}
		if(b==1){
			break;}
	} {
		if(bun[i]==miz[j]){
			for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }}
		}
		if(b==1){
			break;}
	} if(bun[i]==miz[j]){
			for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }}
		} bun[i]==miz[j] bun[i] bun i miz[j] miz j {
			for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }}
		} for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }} j=0; j=0 j 0 j<=q j q j++ j++ j {
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }} {
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }} if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				} bun[i+j]!=miz[j] bun[i+j] bun i+j i j miz[j] miz j {
					tas = 0;
					j = 0;
					break;				} tas = 0 tas 0 j = 0 j 0 break; tas++ tas if(tas==q){
				a = 1;
				b = 1;
				break;     } tas==q tas q {
				a = 1;
				b = 1;
				break;     } a = 1 a 1 b = 1 b 1 break; if(b==1){
			break;} b==1 b 1 {
			break;} break; if(a==1){	
			System.out.println("Yes");}
		else{
			System.out.println("No");} a==1 a 1 {	
			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
import java.util.Scanner;

class Main
{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
	
	int a = 0;
	int tas = 0;;
	int q;
	int i;
	int z;
	int j = 0;
	int b = 0;
	
	String Bun = scan.nextLine();
	String Miz = scan.nextLine();
	
	Bun = Bun + Bun;
	
	char[] bun = Bun.toCharArray();
	char[] miz = Miz.toCharArray();
		
	for(q=0; q<miz.length; q++){
	}
		
	for(z=0; z<bun.length; z++){
	}
		
	int x = z - q;
	
	for(i=0; i<x; i++){
		if(bun[i]==miz[j]){
			for(j=0; j<=q; j++){
				if(bun[i+j]!=miz[j])	{
					tas = 0;
					j = 0;
					break;				}
				tas++;	
				if(tas==q){
				a = 1;
				b = 1;
				break;     }}
		}
		if(b==1){
			break;}
	}
		if(a==1){	
			System.out.println("Yes");}
		else{
			System.out.println("No");}
	}
}
