import java.util.Scanner;

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

        String ring = s1 +s1;

        if(ring.contains(s2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


        scn.close();


    }



} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        String s1 = scn.nextLine();
        String s2 = scn.nextLine();

        String ring = s1 +s1;

        if(ring.contains(s2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


        scn.close();


    }



} Main public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        String s1 = scn.nextLine();
        String s2 = scn.nextLine();

        String ring = s1 +s1;

        if(ring.contains(s2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


        scn.close();


    } main {
        Scanner scn = new Scanner(System.in);
        String s1 = scn.nextLine();
        String s2 = scn.nextLine();

        String ring = s1 +s1;

        if(ring.contains(s2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


        scn.close();


    } Scanner scn = new Scanner(System.in); scn new Scanner(System.in) String s1 = scn.nextLine(); s1 scn.nextLine() scn.nextLine scn String s2 = scn.nextLine(); s2 scn.nextLine() scn.nextLine scn String ring = s1 +s1; ring s1 +s1 s1 s1 if(ring.contains(s2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } ring.contains(s2) ring.contains ring s2 {
            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" scn.close() scn.close scn String args[] args public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        String s1 = scn.nextLine();
        String s2 = scn.nextLine();

        String ring = s1 +s1;

        if(ring.contains(s2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


        scn.close();


    }



} public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        String s1 = scn.nextLine();
        String s2 = scn.nextLine();

        String ring = s1 +s1;

        if(ring.contains(s2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


        scn.close();


    }



} Main
import java.util.Scanner;

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

        String ring = s1 +s1;

        if(ring.contains(s2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


        scn.close();


    }



}
