import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        t = t.concat(t);
        String check = "No";
        for(int i=0; i<n; i++){
            if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            }
        }
        System.out.println(check);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        t = t.concat(t);
        String check = "No";
        for(int i=0; i<n; i++){
            if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            }
        }
        System.out.println(check);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        t = t.concat(t);
        String check = "No";
        for(int i=0; i<n; i++){
            if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            }
        }
        System.out.println(check);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        t = t.concat(t);
        String check = "No";
        for(int i=0; i<n; i++){
            if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            }
        }
        System.out.println(check);
    } 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 int n = s.length(); n s.length() s.length s t = t.concat(t) t t.concat(t) t.concat t t String check = "No"; check "No" for(int i=0; i<n; i++){
            if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            }
        } {
            if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            }
        } if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            } s.equals(t.substring(i,i+n)) s.equals s t.substring(i,i+n) t.substring t i i+n i n {
                check = "Yes";
            } check = "Yes" check "Yes" System.out.println(check) System.out.println System.out System System.out check String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        t = t.concat(t);
        String check = "No";
        for(int i=0; i<n; i++){
            if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            }
        }
        System.out.println(check);
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        t = t.concat(t);
        String check = "No";
        for(int i=0; i<n; i++){
            if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            }
        }
        System.out.println(check);
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        t = t.concat(t);
        String check = "No";
        for(int i=0; i<n; i++){
            if(s.equals(t.substring(i,i+n))){
                check = "Yes";
            }
        }
        System.out.println(check);
    }
}