import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder S = new StringBuilder(sc.nextLine());
        String T = sc.nextLine();
        sc.close();
        boolean ans = false;
        int len = S.length();
        for(int i = 0; i <= len; i++){
            S.insert(0, S.charAt(len-1));
            S.deleteCharAt(len);
            if(S.toString().equals(T)){
                ans = true;
                break;
            }
        }
        if(ans) 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 sc = new Scanner(System.in);
        StringBuilder S = new StringBuilder(sc.nextLine());
        String T = sc.nextLine();
        sc.close();
        boolean ans = false;
        int len = S.length();
        for(int i = 0; i <= len; i++){
            S.insert(0, S.charAt(len-1));
            S.deleteCharAt(len);
            if(S.toString().equals(T)){
                ans = true;
                break;
            }
        }
        if(ans) System.out.println("Yes");
        else System.out.println("No");

    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder S = new StringBuilder(sc.nextLine());
        String T = sc.nextLine();
        sc.close();
        boolean ans = false;
        int len = S.length();
        for(int i = 0; i <= len; i++){
            S.insert(0, S.charAt(len-1));
            S.deleteCharAt(len);
            if(S.toString().equals(T)){
                ans = true;
                break;
            }
        }
        if(ans) System.out.println("Yes");
        else System.out.println("No");

    } main {
        Scanner sc = new Scanner(System.in);
        StringBuilder S = new StringBuilder(sc.nextLine());
        String T = sc.nextLine();
        sc.close();
        boolean ans = false;
        int len = S.length();
        for(int i = 0; i <= len; i++){
            S.insert(0, S.charAt(len-1));
            S.deleteCharAt(len);
            if(S.toString().equals(T)){
                ans = true;
                break;
            }
        }
        if(ans) System.out.println("Yes");
        else System.out.println("No");

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder S = new StringBuilder(sc.nextLine()); S new StringBuilder(sc.nextLine()) String T = sc.nextLine(); T sc.nextLine() sc.nextLine sc sc.close() sc.close sc boolean ans = false; ans false int len = S.length(); len S.length() S.length S for(int i = 0; i <= len; i++){
            S.insert(0, S.charAt(len-1));
            S.deleteCharAt(len);
            if(S.toString().equals(T)){
                ans = true;
                break;
            }
        } int i = 0; int i = 0; i 0 i <= len i len i++ i++ i {
            S.insert(0, S.charAt(len-1));
            S.deleteCharAt(len);
            if(S.toString().equals(T)){
                ans = true;
                break;
            }
        } {
            S.insert(0, S.charAt(len-1));
            S.deleteCharAt(len);
            if(S.toString().equals(T)){
                ans = true;
                break;
            }
        } S.insert(0, S.charAt(len-1)) S.insert S 0 S.charAt(len-1) S.charAt S len-1 len 1 S.deleteCharAt(len) S.deleteCharAt S len if(S.toString().equals(T)){
                ans = true;
                break;
            } S.toString().equals(T) S.toString().equals S.toString() S.toString S T {
                ans = true;
                break;
            } ans = true ans true break; if(ans) System.out.println("Yes");
        else System.out.println("No"); ans 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 void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder S = new StringBuilder(sc.nextLine());
        String T = sc.nextLine();
        sc.close();
        boolean ans = false;
        int len = S.length();
        for(int i = 0; i <= len; i++){
            S.insert(0, S.charAt(len-1));
            S.deleteCharAt(len);
            if(S.toString().equals(T)){
                ans = true;
                break;
            }
        }
        if(ans) System.out.println("Yes");
        else System.out.println("No");

    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder S = new StringBuilder(sc.nextLine());
        String T = sc.nextLine();
        sc.close();
        boolean ans = false;
        int len = S.length();
        for(int i = 0; i <= len; i++){
            S.insert(0, S.charAt(len-1));
            S.deleteCharAt(len);
            if(S.toString().equals(T)){
                ans = true;
                break;
            }
        }
        if(ans) System.out.println("Yes");
        else System.out.println("No");

    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder S = new StringBuilder(sc.nextLine());
        String T = sc.nextLine();
        sc.close();
        boolean ans = false;
        int len = S.length();
        for(int i = 0; i <= len; i++){
            S.insert(0, S.charAt(len-1));
            S.deleteCharAt(len);
            if(S.toString().equals(T)){
                ans = true;
                break;
            }
        }
        if(ans) System.out.println("Yes");
        else System.out.println("No");

    }

}
