import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),t = sc.next();
        String ans = "No";
        for(int i =0;i<s.length();i++){
            if(s.equals(t)){
                ans = "Yes";
                break;
            }
            String tmp = s.substring(s.length()-1);
            String tmpB = s.substring(0,s.length()-1);
            s = tmp + tmpB;
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),t = sc.next();
        String ans = "No";
        for(int i =0;i<s.length();i++){
            if(s.equals(t)){
                ans = "Yes";
                break;
            }
            String tmp = s.substring(s.length()-1);
            String tmpB = s.substring(0,s.length()-1);
            s = tmp + tmpB;
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),t = sc.next();
        String ans = "No";
        for(int i =0;i<s.length();i++){
            if(s.equals(t)){
                ans = "Yes";
                break;
            }
            String tmp = s.substring(s.length()-1);
            String tmpB = s.substring(0,s.length()-1);
            s = tmp + tmpB;
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),t = sc.next();
        String ans = "No";
        for(int i =0;i<s.length();i++){
            if(s.equals(t)){
                ans = "Yes";
                break;
            }
            String tmp = s.substring(s.length()-1);
            String tmpB = s.substring(0,s.length()-1);
            s = tmp + tmpB;
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next() s sc.next() sc.next sc t = sc.next(); t sc.next() sc.next sc String ans = "No"; ans "No" for(int i =0;i<s.length();i++){
            if(s.equals(t)){
                ans = "Yes";
                break;
            }
            String tmp = s.substring(s.length()-1);
            String tmpB = s.substring(0,s.length()-1);
            s = tmp + tmpB;
        } int i =0; int i =0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
            if(s.equals(t)){
                ans = "Yes";
                break;
            }
            String tmp = s.substring(s.length()-1);
            String tmpB = s.substring(0,s.length()-1);
            s = tmp + tmpB;
        } {
            if(s.equals(t)){
                ans = "Yes";
                break;
            }
            String tmp = s.substring(s.length()-1);
            String tmpB = s.substring(0,s.length()-1);
            s = tmp + tmpB;
        } if(s.equals(t)){
                ans = "Yes";
                break;
            } s.equals(t) s.equals s t {
                ans = "Yes";
                break;
            } ans = "Yes" ans "Yes" break; String tmp = s.substring(s.length()-1); tmp s.substring(s.length()-1) s.substring s s.length()-1 s.length() s.length s 1 String tmpB = s.substring(0,s.length()-1); tmpB s.substring(0,s.length()-1) s.substring s 0 s.length()-1 s.length() s.length s 1 s = tmp + tmpB s tmp + tmpB tmp tmpB System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),t = sc.next();
        String ans = "No";
        for(int i =0;i<s.length();i++){
            if(s.equals(t)){
                ans = "Yes";
                break;
            }
            String tmp = s.substring(s.length()-1);
            String tmpB = s.substring(0,s.length()-1);
            s = tmp + tmpB;
        }
        System.out.println(ans);
    }
}