import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String convertString = sc.nextLine();
		String matchString = sc.nextLine();
		char[] convertChar = convertString.toCharArray();
		String okay = "No";
		for(int i = 0; i< convertChar.length ; i++) {
			char sorttemp = convertChar[convertChar.length-1]; 
			for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			}
			convertChar[0] = sorttemp;
			String convertedString = String.valueOf(convertChar);
			if(convertedString.equals(matchString)) {
				okay = "Yes";
			}
		}
		System.out.println(okay);
	}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String convertString = sc.nextLine();
		String matchString = sc.nextLine();
		char[] convertChar = convertString.toCharArray();
		String okay = "No";
		for(int i = 0; i< convertChar.length ; i++) {
			char sorttemp = convertChar[convertChar.length-1]; 
			for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			}
			convertChar[0] = sorttemp;
			String convertedString = String.valueOf(convertChar);
			if(convertedString.equals(matchString)) {
				okay = "Yes";
			}
		}
		System.out.println(okay);
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String convertString = sc.nextLine();
		String matchString = sc.nextLine();
		char[] convertChar = convertString.toCharArray();
		String okay = "No";
		for(int i = 0; i< convertChar.length ; i++) {
			char sorttemp = convertChar[convertChar.length-1]; 
			for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			}
			convertChar[0] = sorttemp;
			String convertedString = String.valueOf(convertChar);
			if(convertedString.equals(matchString)) {
				okay = "Yes";
			}
		}
		System.out.println(okay);
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String convertString = sc.nextLine();
		String matchString = sc.nextLine();
		char[] convertChar = convertString.toCharArray();
		String okay = "No";
		for(int i = 0; i< convertChar.length ; i++) {
			char sorttemp = convertChar[convertChar.length-1]; 
			for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			}
			convertChar[0] = sorttemp;
			String convertedString = String.valueOf(convertChar);
			if(convertedString.equals(matchString)) {
				okay = "Yes";
			}
		}
		System.out.println(okay);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String convertString = sc.nextLine(); convertString sc.nextLine() sc.nextLine sc String matchString = sc.nextLine(); matchString sc.nextLine() sc.nextLine sc char[] convertChar = convertString.toCharArray(); convertChar convertString.toCharArray() convertString.toCharArray convertString String okay = "No"; okay "No" for(int i = 0; i< convertChar.length ; i++) {
			char sorttemp = convertChar[convertChar.length-1]; 
			for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			}
			convertChar[0] = sorttemp;
			String convertedString = String.valueOf(convertChar);
			if(convertedString.equals(matchString)) {
				okay = "Yes";
			}
		} int i = 0; int i = 0; i 0 i< convertChar.length i convertChar.length convertChar convertChar.length i++ i++ i {
			char sorttemp = convertChar[convertChar.length-1]; 
			for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			}
			convertChar[0] = sorttemp;
			String convertedString = String.valueOf(convertChar);
			if(convertedString.equals(matchString)) {
				okay = "Yes";
			}
		} {
			char sorttemp = convertChar[convertChar.length-1]; 
			for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			}
			convertChar[0] = sorttemp;
			String convertedString = String.valueOf(convertChar);
			if(convertedString.equals(matchString)) {
				okay = "Yes";
			}
		} char sorttemp = convertChar[convertChar.length-1]; sorttemp convertChar[convertChar.length-1] convertChar convertChar.length-1 convertChar.length convertChar convertChar.length 1 for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			} int j = convertChar.length -1; int j = convertChar.length -1; j convertChar.length -1 convertChar.length convertChar convertChar.length 1 j >= 1 j 1 j-- j-- j {
				convertChar[j] = convertChar[j-1]; 
			} {
				convertChar[j] = convertChar[j-1]; 
			} convertChar[j] = convertChar[j-1] convertChar[j] convertChar j convertChar[j-1] convertChar j-1 j 1 convertChar[0] = sorttemp convertChar[0] convertChar 0 sorttemp String convertedString = String.valueOf(convertChar); convertedString String.valueOf(convertChar) String.valueOf String convertChar if(convertedString.equals(matchString)) {
				okay = "Yes";
			} convertedString.equals(matchString) convertedString.equals convertedString matchString {
				okay = "Yes";
			} okay = "Yes" okay "Yes" System.out.println(okay) System.out.println System.out System System.out okay String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String convertString = sc.nextLine();
		String matchString = sc.nextLine();
		char[] convertChar = convertString.toCharArray();
		String okay = "No";
		for(int i = 0; i< convertChar.length ; i++) {
			char sorttemp = convertChar[convertChar.length-1]; 
			for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			}
			convertChar[0] = sorttemp;
			String convertedString = String.valueOf(convertChar);
			if(convertedString.equals(matchString)) {
				okay = "Yes";
			}
		}
		System.out.println(okay);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String convertString = sc.nextLine();
		String matchString = sc.nextLine();
		char[] convertChar = convertString.toCharArray();
		String okay = "No";
		for(int i = 0; i< convertChar.length ; i++) {
			char sorttemp = convertChar[convertChar.length-1]; 
			for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			}
			convertChar[0] = sorttemp;
			String convertedString = String.valueOf(convertChar);
			if(convertedString.equals(matchString)) {
				okay = "Yes";
			}
		}
		System.out.println(okay);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String convertString = sc.nextLine();
		String matchString = sc.nextLine();
		char[] convertChar = convertString.toCharArray();
		String okay = "No";
		for(int i = 0; i< convertChar.length ; i++) {
			char sorttemp = convertChar[convertChar.length-1]; 
			for(int j = convertChar.length -1; j >= 1  ; j--) {
				convertChar[j] = convertChar[j-1]; 
			}
			convertChar[0] = sorttemp;
			String convertedString = String.valueOf(convertChar);
			if(convertedString.equals(matchString)) {
				okay = "Yes";
			}
		}
		System.out.println(okay);
	}

}
