import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		Scanner scan = new Scanner(System.in);
		
		String ringText =scan.nextLine();
		int ringLength = ringText.length();
		char[] ringChar = ringText.toCharArray();
		
		String target =scan.nextLine();
		int targetLength = target.length();
		
		String hikaku = "";
		
		boolean kai = false;
		
		for(int i=0; i<ringLength; i++){
				hikaku = "";
				kai = false;
				
				for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				}
				if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				}
		}
		
		if(kai == false){
			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{
		Scanner scan = new Scanner(System.in);
		
		String ringText =scan.nextLine();
		int ringLength = ringText.length();
		char[] ringChar = ringText.toCharArray();
		
		String target =scan.nextLine();
		int targetLength = target.length();
		
		String hikaku = "";
		
		boolean kai = false;
		
		for(int i=0; i<ringLength; i++){
				hikaku = "";
				kai = false;
				
				for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				}
				if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				}
		}
		
		if(kai == false){
			System.out.println("No");
		}
	}
} Main public static void main(String[] args)throws NumberFormatException, IOException{
		Scanner scan = new Scanner(System.in);
		
		String ringText =scan.nextLine();
		int ringLength = ringText.length();
		char[] ringChar = ringText.toCharArray();
		
		String target =scan.nextLine();
		int targetLength = target.length();
		
		String hikaku = "";
		
		boolean kai = false;
		
		for(int i=0; i<ringLength; i++){
				hikaku = "";
				kai = false;
				
				for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				}
				if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				}
		}
		
		if(kai == false){
			System.out.println("No");
		}
	} main {
		Scanner scan = new Scanner(System.in);
		
		String ringText =scan.nextLine();
		int ringLength = ringText.length();
		char[] ringChar = ringText.toCharArray();
		
		String target =scan.nextLine();
		int targetLength = target.length();
		
		String hikaku = "";
		
		boolean kai = false;
		
		for(int i=0; i<ringLength; i++){
				hikaku = "";
				kai = false;
				
				for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				}
				if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				}
		}
		
		if(kai == false){
			System.out.println("No");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String ringText =scan.nextLine(); ringText scan.nextLine() scan.nextLine scan int ringLength = ringText.length(); ringLength ringText.length() ringText.length ringText char[] ringChar = ringText.toCharArray(); ringChar ringText.toCharArray() ringText.toCharArray ringText String target =scan.nextLine(); target scan.nextLine() scan.nextLine scan int targetLength = target.length(); targetLength target.length() target.length target String hikaku = ""; hikaku "" boolean kai = false; kai false for(int i=0; i<ringLength; i++){
				hikaku = "";
				kai = false;
				
				for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				}
				if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				}
		} int i=0; int i=0; i 0 i<ringLength i ringLength i++ i++ i {
				hikaku = "";
				kai = false;
				
				for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				}
				if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				}
		} {
				hikaku = "";
				kai = false;
				
				for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				}
				if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				}
		} hikaku = "" hikaku "" kai = false kai false for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				} int j=0; int j=0; j 0 j<targetLength j targetLength j++ j++ j {
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				} {
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				} int i2 = j; i2 j if(i + i2 >= ringLength){
						i2 -= ringLength;
					} i + i2 >= ringLength i + i2 i i2 ringLength {
						i2 -= ringLength;
					} i2 -= ringLength i2 ringLength hikaku = hikaku + ringChar[i+i2] hikaku hikaku + ringChar[i+i2] hikaku ringChar[i+i2] ringChar i+i2 i i2 if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				} target.equals(hikaku) target.equals target hikaku {
					System.out.println("Yes");
					kai = true;
					break;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" kai = true kai true break; if(kai == false){
			System.out.println("No");
		} kai == false kai false {
			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{
		Scanner scan = new Scanner(System.in);
		
		String ringText =scan.nextLine();
		int ringLength = ringText.length();
		char[] ringChar = ringText.toCharArray();
		
		String target =scan.nextLine();
		int targetLength = target.length();
		
		String hikaku = "";
		
		boolean kai = false;
		
		for(int i=0; i<ringLength; i++){
				hikaku = "";
				kai = false;
				
				for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				}
				if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				}
		}
		
		if(kai == false){
			System.out.println("No");
		}
	}
}