import java.io.*;

public class Main{
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        int cnt = 0;

        for(int i = 0; i < s.length(); i++){
            cnt = 0;
            for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            }
            if(cnt == p.length()){
                break;
            }
        }
        if(cnt == p.length()){
            System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    }
} import java.io.*; io.* java public class Main{
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        int cnt = 0;

        for(int i = 0; i < s.length(); i++){
            cnt = 0;
            for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            }
            if(cnt == p.length()){
                break;
            }
        }
        if(cnt == p.length()){
            System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    }
} Main public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        int cnt = 0;

        for(int i = 0; i < s.length(); i++){
            cnt = 0;
            for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            }
            if(cnt == p.length()){
                break;
            }
        }
        if(cnt == p.length()){
            System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        int cnt = 0;

        for(int i = 0; i < s.length(); i++){
            cnt = 0;
            for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            }
            if(cnt == p.length()){
                break;
            }
        }
        if(cnt == p.length()){
            System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s = br.readLine(); s br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br int cnt = 0; cnt 0 for(int i = 0; i < s.length(); i++){
            cnt = 0;
            for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            }
            if(cnt == p.length()){
                break;
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            cnt = 0;
            for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            }
            if(cnt == p.length()){
                break;
            }
        } {
            cnt = 0;
            for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            }
            if(cnt == p.length()){
                break;
            }
        } cnt = 0 cnt 0 for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            } int j = 0; int j = 0; j 0 j < p.length() j p.length() p.length p j++ j++ j {
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            } {
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            } if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                } s.charAt((i+j) % s.length()) == p.charAt(j) s.charAt((i+j) % s.length()) s.charAt s (i+j) % s.length() (i+j) i j s.length() s.length s p.charAt(j) p.charAt p j {
                    cnt++;
                } cnt++ cnt {
                    break;
                } break; if(cnt == p.length()){
                break;
            } cnt == p.length() cnt p.length() p.length p {
                break;
            } break; if(cnt == p.length()){
            System.out.println("Yes");
        }else{
        System.out.println("No");
        } cnt == p.length() cnt p.length() p.length p {
            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 public class Main{
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        int cnt = 0;

        for(int i = 0; i < s.length(); i++){
            cnt = 0;
            for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            }
            if(cnt == p.length()){
                break;
            }
        }
        if(cnt == p.length()){
            System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    }
} public class Main{
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        int cnt = 0;

        for(int i = 0; i < s.length(); i++){
            cnt = 0;
            for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            }
            if(cnt == p.length()){
                break;
            }
        }
        if(cnt == p.length()){
            System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    }
} Main
import java.io.*;

public class Main{
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        int cnt = 0;

        for(int i = 0; i < s.length(); i++){
            cnt = 0;
            for(int j = 0; j < p.length(); j++){
                if(s.charAt((i+j) % s.length()) == p.charAt(j)){
                    cnt++;
                }else{
                    break;
                }
            }
            if(cnt == p.length()){
                break;
            }
        }
        if(cnt == p.length()){
            System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    }
}