import java.util.*;
class Main {
    public static void main(String...args) {
        boolean isCollect = false;
        int count = 0;
        Scanner scan = new Scanner(System.in);
        String ring = scan.nextLine();
        String str = scan.nextLine();
        char[] chrs = ring.toCharArray();
        List<Character> ringList = new ArrayList<>();
        for(int k = 0 ; k < 2; k++) {
            for(char c :chrs) {
                ringList.add(new Character(c));
            }
        }
        for(int i = 0; i < ring.length(); i++) {
            for(int j = 0; j <str.length(); j++) {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            }
            if(count == str.length()) {
                isCollect = true;
            } 
        }
        if(isCollect) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}


 import java.util.*; util.* java class Main {
    public static void main(String...args) {
        boolean isCollect = false;
        int count = 0;
        Scanner scan = new Scanner(System.in);
        String ring = scan.nextLine();
        String str = scan.nextLine();
        char[] chrs = ring.toCharArray();
        List<Character> ringList = new ArrayList<>();
        for(int k = 0 ; k < 2; k++) {
            for(char c :chrs) {
                ringList.add(new Character(c));
            }
        }
        for(int i = 0; i < ring.length(); i++) {
            for(int j = 0; j <str.length(); j++) {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            }
            if(count == str.length()) {
                isCollect = true;
            } 
        }
        if(isCollect) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} Main public static void main(String...args) {
        boolean isCollect = false;
        int count = 0;
        Scanner scan = new Scanner(System.in);
        String ring = scan.nextLine();
        String str = scan.nextLine();
        char[] chrs = ring.toCharArray();
        List<Character> ringList = new ArrayList<>();
        for(int k = 0 ; k < 2; k++) {
            for(char c :chrs) {
                ringList.add(new Character(c));
            }
        }
        for(int i = 0; i < ring.length(); i++) {
            for(int j = 0; j <str.length(); j++) {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            }
            if(count == str.length()) {
                isCollect = true;
            } 
        }
        if(isCollect) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    } main {
        boolean isCollect = false;
        int count = 0;
        Scanner scan = new Scanner(System.in);
        String ring = scan.nextLine();
        String str = scan.nextLine();
        char[] chrs = ring.toCharArray();
        List<Character> ringList = new ArrayList<>();
        for(int k = 0 ; k < 2; k++) {
            for(char c :chrs) {
                ringList.add(new Character(c));
            }
        }
        for(int i = 0; i < ring.length(); i++) {
            for(int j = 0; j <str.length(); j++) {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            }
            if(count == str.length()) {
                isCollect = true;
            } 
        }
        if(isCollect) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    } boolean isCollect = false; isCollect false int count = 0; count 0 Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String ring = scan.nextLine(); ring scan.nextLine() scan.nextLine scan String str = scan.nextLine(); str scan.nextLine() scan.nextLine scan char[] chrs = ring.toCharArray(); chrs ring.toCharArray() ring.toCharArray ring List<Character> ringList = new ArrayList<>(); ringList new ArrayList<>() for(int k = 0 ; k < 2; k++) {
            for(char c :chrs) {
                ringList.add(new Character(c));
            }
        } int k = 0 ; int k = 0 ; k 0 k < 2 k 2 k++ k++ k {
            for(char c :chrs) {
                ringList.add(new Character(c));
            }
        } {
            for(char c :chrs) {
                ringList.add(new Character(c));
            }
        } for(char c :chrs) {
                ringList.add(new Character(c));
            } char c chrs {
                ringList.add(new Character(c));
            } {
                ringList.add(new Character(c));
            } ringList.add(new Character(c)) ringList.add ringList new Character(c) for(int i = 0; i < ring.length(); i++) {
            for(int j = 0; j <str.length(); j++) {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            }
            if(count == str.length()) {
                isCollect = true;
            } 
        } int i = 0; int i = 0; i 0 i < ring.length() i ring.length() ring.length ring i++ i++ i {
            for(int j = 0; j <str.length(); j++) {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            }
            if(count == str.length()) {
                isCollect = true;
            } 
        } {
            for(int j = 0; j <str.length(); j++) {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            }
            if(count == str.length()) {
                isCollect = true;
            } 
        } for(int j = 0; j <str.length(); j++) {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            } int j = 0; int j = 0; j 0 j <str.length() j str.length() str.length str j++ j++ j {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            } {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            } if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                } ringList.get(i + j) != str.charAt(j) ringList.get(i + j) ringList.get ringList i + j i j str.charAt(j) str.charAt str j {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                } count = 0 count 0 for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    } int k = 0 ; int k = 0 ; k 0 k < 2 k 2 k++ k++ k {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    } {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    } for(char c :chrs) {
                            ringList.add(new Character(c));
                        } char c chrs {
                            ringList.add(new Character(c));
                        } {
                            ringList.add(new Character(c));
                        } ringList.add(new Character(c)) ringList.add ringList new Character(c) break; {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                } count++ count if(count == str.length()) {
                isCollect = true;
            } count == str.length() count str.length() str.length str {
                isCollect = true;
            } isCollect = true isCollect true if(isCollect) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        } isCollect {
            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" String...args args
import java.util.*;
class Main {
    public static void main(String...args) {
        boolean isCollect = false;
        int count = 0;
        Scanner scan = new Scanner(System.in);
        String ring = scan.nextLine();
        String str = scan.nextLine();
        char[] chrs = ring.toCharArray();
        List<Character> ringList = new ArrayList<>();
        for(int k = 0 ; k < 2; k++) {
            for(char c :chrs) {
                ringList.add(new Character(c));
            }
        }
        for(int i = 0; i < ring.length(); i++) {
            for(int j = 0; j <str.length(); j++) {
                if(ringList.get(i + j) != str.charAt(j)) {
                    count = 0;
                    for(int k = 0 ; k < 2; k++) {
                        for(char c :chrs) {
                            ringList.add(new Character(c));
                        }
                    }   
                    break;
                }
                else {
                    //Character replace = ringList.get(0);
                    count++;
                    //ringList.add(replace);
                }
            }
            if(count == str.length()) {
                isCollect = true;
            } 
        }
        if(isCollect) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}



