import java.util.*;
import java.lang.*;
import java.io.*;

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

        String s = sc.next();
        String t = sc.next();
        String result = "No";

        for(int i = 0; i < s.length(); i++){
            if(t.equals(s)){
                result = "Yes";
            }
            s = turn(s);
        }

        System.out.println(result);
    }

    static String turn(String s){
        String end = s.substring(s.length() - 1, s.length());
        String tmp = end + s;
        return  tmp.substring(0,tmp.length() - 1);
    }
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();
        String result = "No";

        for(int i = 0; i < s.length(); i++){
            if(t.equals(s)){
                result = "Yes";
            }
            s = turn(s);
        }

        System.out.println(result);
    }

    static String turn(String s){
        String end = s.substring(s.length() - 1, s.length());
        String tmp = end + s;
        return  tmp.substring(0,tmp.length() - 1);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();
        String result = "No";

        for(int i = 0; i < s.length(); i++){
            if(t.equals(s)){
                result = "Yes";
            }
            s = turn(s);
        }

        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();
        String result = "No";

        for(int i = 0; i < s.length(); i++){
            if(t.equals(s)){
                result = "Yes";
            }
            s = turn(s);
        }

        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc String result = "No"; result "No" for(int i = 0; i < s.length(); i++){
            if(t.equals(s)){
                result = "Yes";
            }
            s = turn(s);
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            if(t.equals(s)){
                result = "Yes";
            }
            s = turn(s);
        } {
            if(t.equals(s)){
                result = "Yes";
            }
            s = turn(s);
        } if(t.equals(s)){
                result = "Yes";
            } t.equals(s) t.equals t s {
                result = "Yes";
            } result = "Yes" result "Yes" s = turn(s) s turn(s) turn s System.out.println(result) System.out.println System.out System System.out result String[] args args static String turn(String s){
        String end = s.substring(s.length() - 1, s.length());
        String tmp = end + s;
        return  tmp.substring(0,tmp.length() - 1);
    } turn {
        String end = s.substring(s.length() - 1, s.length());
        String tmp = end + s;
        return  tmp.substring(0,tmp.length() - 1);
    } String end = s.substring(s.length() - 1, s.length()); end s.substring(s.length() - 1, s.length()) s.substring s s.length() - 1 s.length() s.length s 1 s.length() s.length s String tmp = end + s; tmp end + s end s return  tmp.substring(0,tmp.length() - 1); tmp.substring(0,tmp.length() - 1) tmp.substring tmp 0 tmp.length() - 1 tmp.length() tmp.length tmp 1 String s s
import java.util.*;
import java.lang.*;
import java.io.*;

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

        String s = sc.next();
        String t = sc.next();
        String result = "No";

        for(int i = 0; i < s.length(); i++){
            if(t.equals(s)){
                result = "Yes";
            }
            s = turn(s);
        }

        System.out.println(result);
    }

    static String turn(String s){
        String end = s.substring(s.length() - 1, s.length());
        String tmp = end + s;
        return  tmp.substring(0,tmp.length() - 1);
    }
}
