import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String s1 = s+s;
		char []s1str = s1.toCharArray();
		
		String p = sc.nextLine();
		char []pstr = p.toCharArray();
		boolean flag = false;
		
		String msg = "No";
		
		for (int i = 0; i < s.length(); i++){
		    for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    }
		    
		    if (flag == true){
		        msg = "Yes";
		        break;
		    } 
		} 
		
		System.out.println(msg);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String s1 = s+s;
		char []s1str = s1.toCharArray();
		
		String p = sc.nextLine();
		char []pstr = p.toCharArray();
		boolean flag = false;
		
		String msg = "No";
		
		for (int i = 0; i < s.length(); i++){
		    for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    }
		    
		    if (flag == true){
		        msg = "Yes";
		        break;
		    } 
		} 
		
		System.out.println(msg);
	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String s1 = s+s;
		char []s1str = s1.toCharArray();
		
		String p = sc.nextLine();
		char []pstr = p.toCharArray();
		boolean flag = false;
		
		String msg = "No";
		
		for (int i = 0; i < s.length(); i++){
		    for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    }
		    
		    if (flag == true){
		        msg = "Yes";
		        break;
		    } 
		} 
		
		System.out.println(msg);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String s1 = s+s;
		char []s1str = s1.toCharArray();
		
		String p = sc.nextLine();
		char []pstr = p.toCharArray();
		boolean flag = false;
		
		String msg = "No";
		
		for (int i = 0; i < s.length(); i++){
		    for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    }
		    
		    if (flag == true){
		        msg = "Yes";
		        break;
		    } 
		} 
		
		System.out.println(msg);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String s1 = s+s; s1 s+s s s char []s1str = s1.toCharArray(); s1str s1.toCharArray() s1.toCharArray s1 String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc char []pstr = p.toCharArray(); pstr p.toCharArray() p.toCharArray p boolean flag = false; flag false String msg = "No"; msg "No" for (int i = 0; i < s.length(); i++){
		    for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    }
		    
		    if (flag == true){
		        msg = "Yes";
		        break;
		    } 
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
		    for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    }
		    
		    if (flag == true){
		        msg = "Yes";
		        break;
		    } 
		} {
		    for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    }
		    
		    if (flag == true){
		        msg = "Yes";
		        break;
		    } 
		} for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    } int l = 0; int l = 0; l 0 l < p.length() l p.length() p.length p l++ l++ l {
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    } {
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    } if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        } s1str[i+l] != pstr[l] s1str[i+l] s1str i+l i l pstr[l] pstr l {
		            flag = false;
		            break;
		        } flag = false flag false break; flag = true flag true if (flag == true){
		        msg = "Yes";
		        break;
		    } flag == true flag true {
		        msg = "Yes";
		        break;
		    } msg = "Yes" msg "Yes" break; System.out.println(msg) System.out.println System.out System System.out msg String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String s1 = s+s;
		char []s1str = s1.toCharArray();
		
		String p = sc.nextLine();
		char []pstr = p.toCharArray();
		boolean flag = false;
		
		String msg = "No";
		
		for (int i = 0; i < s.length(); i++){
		    for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    }
		    
		    if (flag == true){
		        msg = "Yes";
		        break;
		    } 
		} 
		
		System.out.println(msg);
	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String s1 = s+s;
		char []s1str = s1.toCharArray();
		
		String p = sc.nextLine();
		char []pstr = p.toCharArray();
		boolean flag = false;
		
		String msg = "No";
		
		for (int i = 0; i < s.length(); i++){
		    for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    }
		    
		    if (flag == true){
		        msg = "Yes";
		        break;
		    } 
		} 
		
		System.out.println(msg);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String s1 = s+s;
		char []s1str = s1.toCharArray();
		
		String p = sc.nextLine();
		char []pstr = p.toCharArray();
		boolean flag = false;
		
		String msg = "No";
		
		for (int i = 0; i < s.length(); i++){
		    for(int l = 0; l < p.length(); l++){
		        if (s1str[i+l] != pstr[l]){
		            flag = false;
		            break;
		        }
		        flag = true;
		    }
		    
		    if (flag == true){
		        msg = "Yes";
		        break;
		    } 
		} 
		
		System.out.println(msg);
	}
}
