import java.util.Scanner;

class Main{

	public static void main(String[] args) {


		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();


		for(int i =0;i < S.length();i++){
			if(S.equals(T)){
				System.out.println("Yes");
				return;
			}else{
				T =  rotate(T);
			}
		}
		System.out.println("No");


	}

	static String rotate(String T){
		String aa = T.substring(1)+T.substring(0, 1);
		return aa;



	}


}





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

	public static void main(String[] args) {


		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();


		for(int i =0;i < S.length();i++){
			if(S.equals(T)){
				System.out.println("Yes");
				return;
			}else{
				T =  rotate(T);
			}
		}
		System.out.println("No");


	}

	static String rotate(String T){
		String aa = T.substring(1)+T.substring(0, 1);
		return aa;



	}


} Main public static void main(String[] args) {


		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();


		for(int i =0;i < S.length();i++){
			if(S.equals(T)){
				System.out.println("Yes");
				return;
			}else{
				T =  rotate(T);
			}
		}
		System.out.println("No");


	} main {


		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();


		for(int i =0;i < S.length();i++){
			if(S.equals(T)){
				System.out.println("Yes");
				return;
			}else{
				T =  rotate(T);
			}
		}
		System.out.println("No");


	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan for(int i =0;i < S.length();i++){
			if(S.equals(T)){
				System.out.println("Yes");
				return;
			}else{
				T =  rotate(T);
			}
		} int i =0; int i =0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			if(S.equals(T)){
				System.out.println("Yes");
				return;
			}else{
				T =  rotate(T);
			}
		} {
			if(S.equals(T)){
				System.out.println("Yes");
				return;
			}else{
				T =  rotate(T);
			}
		} if(S.equals(T)){
				System.out.println("Yes");
				return;
			}else{
				T =  rotate(T);
			} S.equals(T) S.equals S T {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; {
				T =  rotate(T);
			} T =  rotate(T) T rotate(T) rotate T System.out.println("No") System.out.println System.out System System.out "No" String[] args args static String rotate(String T){
		String aa = T.substring(1)+T.substring(0, 1);
		return aa;



	} rotate {
		String aa = T.substring(1)+T.substring(0, 1);
		return aa;



	} String aa = T.substring(1)+T.substring(0, 1); aa T.substring(1)+T.substring(0, 1) T.substring(1) T.substring T 1 T.substring(0, 1) T.substring T 0 1 return aa; aa String T T
import java.util.Scanner;

class Main{

	public static void main(String[] args) {


		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();


		for(int i =0;i < S.length();i++){
			if(S.equals(T)){
				System.out.println("Yes");
				return;
			}else{
				T =  rotate(T);
			}
		}
		System.out.println("No");


	}

	static String rotate(String T){
		String aa = T.substring(1)+T.substring(0, 1);
		return aa;



	}


}






