import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	String T = sc.next();
	String newS = S;
	int lastSmoji =  S.length();
	boolean b = true;
	//System.out.println(newS.substring(lastSmoji-1,lastSmoji));
	//System.out.println(newS.substring(0, lastSmoji-1));

	for(int i = 0;i < S.length();i++){
	newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1);
	if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	}
	}

	if(b){
		System.out.println("No");		
	}

	}
}
	
 import java.util.*; util.* java public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	String T = sc.next();
	String newS = S;
	int lastSmoji =  S.length();
	boolean b = true;
	//System.out.println(newS.substring(lastSmoji-1,lastSmoji));
	//System.out.println(newS.substring(0, lastSmoji-1));

	for(int i = 0;i < S.length();i++){
	newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1);
	if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	}
	}

	if(b){
		System.out.println("No");		
	}

	}
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	String T = sc.next();
	String newS = S;
	int lastSmoji =  S.length();
	boolean b = true;
	//System.out.println(newS.substring(lastSmoji-1,lastSmoji));
	//System.out.println(newS.substring(0, lastSmoji-1));

	for(int i = 0;i < S.length();i++){
	newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1);
	if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	}
	}

	if(b){
		System.out.println("No");		
	}

	} main {
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	String T = sc.next();
	String newS = S;
	int lastSmoji =  S.length();
	boolean b = true;
	//System.out.println(newS.substring(lastSmoji-1,lastSmoji));
	//System.out.println(newS.substring(0, lastSmoji-1));

	for(int i = 0;i < S.length();i++){
	newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1);
	if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	}
	}

	if(b){
		System.out.println("No");		
	}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc String newS = S; newS S int lastSmoji =  S.length(); lastSmoji S.length() S.length S boolean b = true; b true for(int i = 0;i < S.length();i++){
	newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1);
	if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	}
	} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
	newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1);
	if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	}
	} {
	newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1);
	if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	}
	} newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1) newS newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1) newS.substring(lastSmoji-1,lastSmoji) newS.substring newS lastSmoji-1 lastSmoji 1 lastSmoji newS.substring(0, lastSmoji-1) newS.substring newS 0 lastSmoji-1 lastSmoji 1 if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	} T.equals(newS) T.equals T newS {
		System.out.println("Yes");
		b = false;
		break;
	} System.out.println("Yes") System.out.println System.out System System.out "Yes" b = false b false break; if(b){
		System.out.println("No");		
	} b {
		System.out.println("No");		
	} 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 sc = new Scanner(System.in);
	String S = sc.next();
	String T = sc.next();
	String newS = S;
	int lastSmoji =  S.length();
	boolean b = true;
	//System.out.println(newS.substring(lastSmoji-1,lastSmoji));
	//System.out.println(newS.substring(0, lastSmoji-1));

	for(int i = 0;i < S.length();i++){
	newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1);
	if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	}
	}

	if(b){
		System.out.println("No");		
	}

	}
} public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	String T = sc.next();
	String newS = S;
	int lastSmoji =  S.length();
	boolean b = true;
	//System.out.println(newS.substring(lastSmoji-1,lastSmoji));
	//System.out.println(newS.substring(0, lastSmoji-1));

	for(int i = 0;i < S.length();i++){
	newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1);
	if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	}
	}

	if(b){
		System.out.println("No");		
	}

	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	String T = sc.next();
	String newS = S;
	int lastSmoji =  S.length();
	boolean b = true;
	//System.out.println(newS.substring(lastSmoji-1,lastSmoji));
	//System.out.println(newS.substring(0, lastSmoji-1));

	for(int i = 0;i < S.length();i++){
	newS = newS.substring(lastSmoji-1,lastSmoji)+newS.substring(0, lastSmoji-1);
	if(T.equals(newS)){
		System.out.println("Yes");
		b = false;
		break;
	}
	}

	if(b){
		System.out.println("No");		
	}

	}
}
	

