import java.util.Scanner;

public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		//B
		String S = sc.next();
		String T = sc.next();
		boolean flag = false;
		for(int i = 0; i < S.length();i++){
			if(S.equals(T)){
				flag = true;
				break;
			}
			S = S.substring(1,S.length())+S.substring(0,1);
		}
		if(flag)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		//B
		String S = sc.next();
		String T = sc.next();
		boolean flag = false;
		for(int i = 0; i < S.length();i++){
			if(S.equals(T)){
				flag = true;
				break;
			}
			S = S.substring(1,S.length())+S.substring(0,1);
		}
		if(flag)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
} Main public static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
		//B
		String S = sc.next();
		String T = sc.next();
		boolean flag = false;
		for(int i = 0; i < S.length();i++){
			if(S.equals(T)){
				flag = true;
				break;
			}
			S = S.substring(1,S.length())+S.substring(0,1);
		}
		if(flag)
			System.out.println("Yes");
		else
			System.out.println("No");
	} main {
		//B
		String S = sc.next();
		String T = sc.next();
		boolean flag = false;
		for(int i = 0; i < S.length();i++){
			if(S.equals(T)){
				flag = true;
				break;
			}
			S = S.substring(1,S.length())+S.substring(0,1);
		}
		if(flag)
			System.out.println("Yes");
		else
			System.out.println("No");
	} String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc boolean flag = false; flag false for(int i = 0; i < S.length();i++){
			if(S.equals(T)){
				flag = true;
				break;
			}
			S = S.substring(1,S.length())+S.substring(0,1);
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			if(S.equals(T)){
				flag = true;
				break;
			}
			S = S.substring(1,S.length())+S.substring(0,1);
		} {
			if(S.equals(T)){
				flag = true;
				break;
			}
			S = S.substring(1,S.length())+S.substring(0,1);
		} if(S.equals(T)){
				flag = true;
				break;
			} S.equals(T) S.equals S T {
				flag = true;
				break;
			} flag = true flag true break; S = S.substring(1,S.length())+S.substring(0,1) S S.substring(1,S.length())+S.substring(0,1) S.substring(1,S.length()) S.substring S 1 S.length() S.length S S.substring(0,1) S.substring S 0 1 if(flag)
			System.out.println("Yes");
		else
			System.out.println("No"); flag System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		//B
		String S = sc.next();
		String T = sc.next();
		boolean flag = false;
		for(int i = 0; i < S.length();i++){
			if(S.equals(T)){
				flag = true;
				break;
			}
			S = S.substring(1,S.length())+S.substring(0,1);
		}
		if(flag)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
} public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		//B
		String S = sc.next();
		String T = sc.next();
		boolean flag = false;
		for(int i = 0; i < S.length();i++){
			if(S.equals(T)){
				flag = true;
				break;
			}
			S = S.substring(1,S.length())+S.substring(0,1);
		}
		if(flag)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
} Main
import java.util.Scanner;

public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		//B
		String S = sc.next();
		String T = sc.next();
		boolean flag = false;
		for(int i = 0; i < S.length();i++){
			if(S.equals(T)){
				flag = true;
				break;
			}
			S = S.substring(1,S.length())+S.substring(0,1);
		}
		if(flag)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}
