import java.util.Scanner;

//B - String Rotation
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        solve(S, T);
        sc.close();
    }

    public static void solve(String s, String t) {
        StringBuilder sb = new StringBuilder(s);
        boolean can = false;
        for (int i = 0; i < s.length(); i++) {
            sb.append(sb.charAt(0)).deleteCharAt(0);
            if (sb.toString().equals(t)) {
                can = true;
                break;
            }
        }
        if (can)
            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);
        String S = sc.nextLine();
        String T = sc.nextLine();
        solve(S, T);
        sc.close();
    }

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

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

    public static void solve(String s, String t) {
        StringBuilder sb = new StringBuilder(s);
        boolean can = false;
        for (int i = 0; i < s.length(); i++) {
            sb.append(sb.charAt(0)).deleteCharAt(0);
            if (sb.toString().equals(t)) {
                can = true;
                break;
            }
        }
        if (can)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} Main
import java.util.Scanner;

//B - String Rotation
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        solve(S, T);
        sc.close();
    }

    public static void solve(String s, String t) {
        StringBuilder sb = new StringBuilder(s);
        boolean can = false;
        for (int i = 0; i < s.length(); i++) {
            sb.append(sb.charAt(0)).deleteCharAt(0);
            if (sb.toString().equals(t)) {
                can = true;
                break;
            }
        }
        if (can)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}
