import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        boolean boo = false;
        String s = sc.next();
        String t = sc.next();
        String str[] = t.split("");
        List<String> list = Arrays.asList(str);
        List<String> list2 = new ArrayList<>(list);
        for(int i=0; i<s.length(); i++){
            String ans = "";
            for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            }
            if(ans.equals(s)){
                boo = true;
                break;
            }
            list2.add(list2.get(0));
            list2.remove(0);
        }
        if(boo) System.out.println("Yes");
        else System.out.println("No");
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        boolean boo = false;
        String s = sc.next();
        String t = sc.next();
        String str[] = t.split("");
        List<String> list = Arrays.asList(str);
        List<String> list2 = new ArrayList<>(list);
        for(int i=0; i<s.length(); i++){
            String ans = "";
            for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            }
            if(ans.equals(s)){
                boo = true;
                break;
            }
            list2.add(list2.get(0));
            list2.remove(0);
        }
        if(boo) System.out.println("Yes");
        else System.out.println("No");
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        boolean boo = false;
        String s = sc.next();
        String t = sc.next();
        String str[] = t.split("");
        List<String> list = Arrays.asList(str);
        List<String> list2 = new ArrayList<>(list);
        for(int i=0; i<s.length(); i++){
            String ans = "";
            for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            }
            if(ans.equals(s)){
                boo = true;
                break;
            }
            list2.add(list2.get(0));
            list2.remove(0);
        }
        if(boo) System.out.println("Yes");
        else System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        boolean boo = false;
        String s = sc.next();
        String t = sc.next();
        String str[] = t.split("");
        List<String> list = Arrays.asList(str);
        List<String> list2 = new ArrayList<>(list);
        for(int i=0; i<s.length(); i++){
            String ans = "";
            for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            }
            if(ans.equals(s)){
                boo = true;
                break;
            }
            list2.add(list2.get(0));
            list2.remove(0);
        }
        if(boo) System.out.println("Yes");
        else System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) boolean boo = false; boo false String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc String str[] = t.split(""); str t.split("") t.split t "" List<String> list = Arrays.asList(str); list Arrays.asList(str) Arrays.asList Arrays str List<String> list2 = new ArrayList<>(list); list2 new ArrayList<>(list) for(int i=0; i<s.length(); i++){
            String ans = "";
            for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            }
            if(ans.equals(s)){
                boo = true;
                break;
            }
            list2.add(list2.get(0));
            list2.remove(0);
        } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
            String ans = "";
            for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            }
            if(ans.equals(s)){
                boo = true;
                break;
            }
            list2.add(list2.get(0));
            list2.remove(0);
        } {
            String ans = "";
            for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            }
            if(ans.equals(s)){
                boo = true;
                break;
            }
            list2.add(list2.get(0));
            list2.remove(0);
        } String ans = ""; ans "" for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            } int j=0; int j=0; j 0 j<list2.size() j list2.size() list2.size list2 j++ j++ j {
                ans += list2.get(j);
            } {
                ans += list2.get(j);
            } ans += list2.get(j) ans list2.get(j) list2.get list2 j if(ans.equals(s)){
                boo = true;
                break;
            } ans.equals(s) ans.equals ans s {
                boo = true;
                break;
            } boo = true boo true break; list2.add(list2.get(0)) list2.add list2 list2.get(0) list2.get list2 0 list2.remove(0) list2.remove list2 0 if(boo) System.out.println("Yes");
        else System.out.println("No"); boo System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        boolean boo = false;
        String s = sc.next();
        String t = sc.next();
        String str[] = t.split("");
        List<String> list = Arrays.asList(str);
        List<String> list2 = new ArrayList<>(list);
        for(int i=0; i<s.length(); i++){
            String ans = "";
            for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            }
            if(ans.equals(s)){
                boo = true;
                break;
            }
            list2.add(list2.get(0));
            list2.remove(0);
        }
        if(boo) System.out.println("Yes");
        else System.out.println("No");
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        boolean boo = false;
        String s = sc.next();
        String t = sc.next();
        String str[] = t.split("");
        List<String> list = Arrays.asList(str);
        List<String> list2 = new ArrayList<>(list);
        for(int i=0; i<s.length(); i++){
            String ans = "";
            for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            }
            if(ans.equals(s)){
                boo = true;
                break;
            }
            list2.add(list2.get(0));
            list2.remove(0);
        }
        if(boo) System.out.println("Yes");
        else System.out.println("No");
    }
} Main
import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        boolean boo = false;
        String s = sc.next();
        String t = sc.next();
        String str[] = t.split("");
        List<String> list = Arrays.asList(str);
        List<String> list2 = new ArrayList<>(list);
        for(int i=0; i<s.length(); i++){
            String ans = "";
            for(int j=0; j<list2.size(); j++){
                ans += list2.get(j);
            }
            if(ans.equals(s)){
                boo = true;
                break;
            }
            list2.add(list2.get(0));
            list2.remove(0);
        }
        if(boo) System.out.println("Yes");
        else System.out.println("No");
    }
}