import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        String rotatedString = S;
        if(S.equals(T)){System.out.println("Yes"); return;}
        for(int x = S.length() - 1; x>0; x--){
            rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1);
            if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");


    }

} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        String rotatedString = S;
        if(S.equals(T)){System.out.println("Yes"); return;}
        for(int x = S.length() - 1; x>0; x--){
            rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1);
            if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");


    }

} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        String rotatedString = S;
        if(S.equals(T)){System.out.println("Yes"); return;}
        for(int x = S.length() - 1; x>0; x--){
            rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1);
            if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");


    } main {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        String rotatedString = S;
        if(S.equals(T)){System.out.println("Yes"); return;}
        for(int x = S.length() - 1; x>0; x--){
            rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1);
            if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");


    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.nextLine(); S scanner.nextLine() scanner.nextLine scanner String T = scanner.nextLine(); T scanner.nextLine() scanner.nextLine scanner String rotatedString = S; rotatedString S if(S.equals(T)){System.out.println("Yes"); return;} S.equals(T) S.equals S T {System.out.println("Yes"); return;} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; for(int x = S.length() - 1; x>0; x--){
            rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1);
            if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            }
        } int x = S.length() - 1; int x = S.length() - 1; x S.length() - 1 S.length() S.length S 1 x>0 x 0 x-- x-- x {
            rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1);
            if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            }
        } {
            rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1);
            if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            }
        } rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1) rotatedString S.substring(x,x+1) + rotatedString.substring(0,S.length()-1) S.substring(x,x+1) S.substring S x x+1 x 1 rotatedString.substring(0,S.length()-1) rotatedString.substring rotatedString 0 S.length()-1 S.length() S.length S 1 if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            } rotatedString.equals(T) rotatedString.equals rotatedString T {
                System.out.println("Yes");
                return;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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 scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        String rotatedString = S;
        if(S.equals(T)){System.out.println("Yes"); return;}
        for(int x = S.length() - 1; x>0; x--){
            rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1);
            if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");


    }

} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        String rotatedString = S;
        if(S.equals(T)){System.out.println("Yes"); return;}
        for(int x = S.length() - 1; x>0; x--){
            rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1);
            if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");


    }

} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String T = scanner.nextLine();
        String rotatedString = S;
        if(S.equals(T)){System.out.println("Yes"); return;}
        for(int x = S.length() - 1; x>0; x--){
            rotatedString = S.substring(x,x+1) + rotatedString.substring(0,S.length()-1);
            if(rotatedString.equals(T)){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");


    }

}
