import java.util.Scanner;
class Main{
    public static void next(String s, int index, String p){
        int i;
        for(i = 1; i < p.length(); i++){
            int sub2 = (index+i)%s.length();
            if(s.charAt(sub2) != p.charAt(i))break;
        }
        if(i == p.length()){
            System.out.println("Yes");
            System.exit(0);
        }
    }

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

        String s, pattern;
        s = scanner.nextLine();
        pattern = scanner.nextLine();

        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == pattern.charAt(0))next(s, i, pattern);
        }
        System.out.println("No");
    }
}
 import java.util.Scanner; Scanner java.util class Main{
    public static void next(String s, int index, String p){
        int i;
        for(i = 1; i < p.length(); i++){
            int sub2 = (index+i)%s.length();
            if(s.charAt(sub2) != p.charAt(i))break;
        }
        if(i == p.length()){
            System.out.println("Yes");
            System.exit(0);
        }
    }

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

        String s, pattern;
        s = scanner.nextLine();
        pattern = scanner.nextLine();

        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == pattern.charAt(0))next(s, i, pattern);
        }
        System.out.println("No");
    }
} Main public static void next(String s, int index, String p){
        int i;
        for(i = 1; i < p.length(); i++){
            int sub2 = (index+i)%s.length();
            if(s.charAt(sub2) != p.charAt(i))break;
        }
        if(i == p.length()){
            System.out.println("Yes");
            System.exit(0);
        }
    } next {
        int i;
        for(i = 1; i < p.length(); i++){
            int sub2 = (index+i)%s.length();
            if(s.charAt(sub2) != p.charAt(i))break;
        }
        if(i == p.length()){
            System.out.println("Yes");
            System.exit(0);
        }
    } int i; i for(i = 1; i < p.length(); i++){
            int sub2 = (index+i)%s.length();
            if(s.charAt(sub2) != p.charAt(i))break;
        } i = 1; i = 1 i 1 i < p.length() i p.length() p.length p i++ i++ i {
            int sub2 = (index+i)%s.length();
            if(s.charAt(sub2) != p.charAt(i))break;
        } {
            int sub2 = (index+i)%s.length();
            if(s.charAt(sub2) != p.charAt(i))break;
        } int sub2 = (index+i)%s.length(); sub2 (index+i)%s.length() (index+i) index i s.length() s.length s if(s.charAt(sub2) != p.charAt(i))break; s.charAt(sub2) != p.charAt(i) s.charAt(sub2) s.charAt s sub2 p.charAt(i) p.charAt p i break; if(i == p.length()){
            System.out.println("Yes");
            System.exit(0);
        } i == p.length() i p.length() p.length p {
            System.out.println("Yes");
            System.exit(0);
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" System.exit(0) System.exit System 0 String s s int index index String p p public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        String s, pattern;
        s = scanner.nextLine();
        pattern = scanner.nextLine();

        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == pattern.charAt(0))next(s, i, pattern);
        }
        System.out.println("No");
    } main {
        Scanner scanner = new Scanner(System.in);

        String s, pattern;
        s = scanner.nextLine();
        pattern = scanner.nextLine();

        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == pattern.charAt(0))next(s, i, pattern);
        }
        System.out.println("No");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s s pattern; pattern s = scanner.nextLine() s scanner.nextLine() scanner.nextLine scanner pattern = scanner.nextLine() pattern scanner.nextLine() scanner.nextLine scanner for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == pattern.charAt(0))next(s, i, pattern);
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            if(s.charAt(i) == pattern.charAt(0))next(s, i, pattern);
        } {
            if(s.charAt(i) == pattern.charAt(0))next(s, i, pattern);
        } if(s.charAt(i) == pattern.charAt(0))next(s, i, pattern); s.charAt(i) == pattern.charAt(0) s.charAt(i) s.charAt s i pattern.charAt(0) pattern.charAt pattern 0 next(s, i, pattern) next s i pattern System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.Scanner;
class Main{
    public static void next(String s, int index, String p){
        int i;
        for(i = 1; i < p.length(); i++){
            int sub2 = (index+i)%s.length();
            if(s.charAt(sub2) != p.charAt(i))break;
        }
        if(i == p.length()){
            System.out.println("Yes");
            System.exit(0);
        }
    }

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

        String s, pattern;
        s = scanner.nextLine();
        pattern = scanner.nextLine();

        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == pattern.charAt(0))next(s, i, pattern);
        }
        System.out.println("No");
    }
}

