import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	String s = scan.next();
	String t = scan.next();

	int flag = -1;
	for(int i = 0; i < s.length(); i++){
	    if(s.equals(t)){
		flag = 1;
		break;
	    }
	    char c = s.charAt(s.length()-1);
	    String C = String.valueOf(c);
	    s = s.substring(0, s.length()-1);
	    s = C+s;
	}

	if(flag == 1){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	String s = scan.next();
	String t = scan.next();

	int flag = -1;
	for(int i = 0; i < s.length(); i++){
	    if(s.equals(t)){
		flag = 1;
		break;
	    }
	    char c = s.charAt(s.length()-1);
	    String C = String.valueOf(c);
	    s = s.substring(0, s.length()-1);
	    s = C+s;
	}

	if(flag == 1){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
    }
} Main public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	String s = scan.next();
	String t = scan.next();

	int flag = -1;
	for(int i = 0; i < s.length(); i++){
	    if(s.equals(t)){
		flag = 1;
		break;
	    }
	    char c = s.charAt(s.length()-1);
	    String C = String.valueOf(c);
	    s = s.substring(0, s.length()-1);
	    s = C+s;
	}

	if(flag == 1){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
    } main {
	Scanner scan = new Scanner(System.in);

	String s = scan.next();
	String t = scan.next();

	int flag = -1;
	for(int i = 0; i < s.length(); i++){
	    if(s.equals(t)){
		flag = 1;
		break;
	    }
	    char c = s.charAt(s.length()-1);
	    String C = String.valueOf(c);
	    s = s.substring(0, s.length()-1);
	    s = C+s;
	}

	if(flag == 1){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String t = scan.next(); t scan.next() scan.next scan int flag = -1; flag -1 1 for(int i = 0; i < s.length(); i++){
	    if(s.equals(t)){
		flag = 1;
		break;
	    }
	    char c = s.charAt(s.length()-1);
	    String C = String.valueOf(c);
	    s = s.substring(0, s.length()-1);
	    s = C+s;
	} 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 = 1;
		break;
	    }
	    char c = s.charAt(s.length()-1);
	    String C = String.valueOf(c);
	    s = s.substring(0, s.length()-1);
	    s = C+s;
	} {
	    if(s.equals(t)){
		flag = 1;
		break;
	    }
	    char c = s.charAt(s.length()-1);
	    String C = String.valueOf(c);
	    s = s.substring(0, s.length()-1);
	    s = C+s;
	} if(s.equals(t)){
		flag = 1;
		break;
	    } s.equals(t) s.equals s t {
		flag = 1;
		break;
	    } flag = 1 flag 1 break; char c = s.charAt(s.length()-1); c s.charAt(s.length()-1) s.charAt s s.length()-1 s.length() s.length s 1 String C = String.valueOf(c); C String.valueOf(c) String.valueOf String c s = s.substring(0, s.length()-1) s s.substring(0, s.length()-1) s.substring s 0 s.length()-1 s.length() s.length s 1 s = C+s s C+s C s if(flag == 1){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	} flag == 1 flag 1 {
	    System.out.println("Yes");
	} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
	    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 scan = new Scanner(System.in);

	String s = scan.next();
	String t = scan.next();

	int flag = -1;
	for(int i = 0; i < s.length(); i++){
	    if(s.equals(t)){
		flag = 1;
		break;
	    }
	    char c = s.charAt(s.length()-1);
	    String C = String.valueOf(c);
	    s = s.substring(0, s.length()-1);
	    s = C+s;
	}

	if(flag == 1){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
    }
} public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	String s = scan.next();
	String t = scan.next();

	int flag = -1;
	for(int i = 0; i < s.length(); i++){
	    if(s.equals(t)){
		flag = 1;
		break;
	    }
	    char c = s.charAt(s.length()-1);
	    String C = String.valueOf(c);
	    s = s.substring(0, s.length()-1);
	    s = C+s;
	}

	if(flag == 1){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	String s = scan.next();
	String t = scan.next();

	int flag = -1;
	for(int i = 0; i < s.length(); i++){
	    if(s.equals(t)){
		flag = 1;
		break;
	    }
	    char c = s.charAt(s.length()-1);
	    String C = String.valueOf(c);
	    s = s.substring(0, s.length()-1);
	    s = C+s;
	}

	if(flag == 1){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
    }
}
