import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        String s=scan.next();
        String p=scan.next();

        int sl=s.length();
        int pl=p.length();
        char S[] = new char[sl];
        char P[] = new char[pl];

        for(int i=0;i<sl;i++){
            S[i]=s.charAt(i);
        }
        for(int i=0;i<pl;i++){
            P[i]=p.charAt(i);
        }
        int i,count=0;
        boolean t=false;
        for(i=0;i<sl;i++){
            count=0;
            for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            }
            if(count==pl){
                break;
            }
        }
        if(count==pl){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        String s=scan.next();
        String p=scan.next();

        int sl=s.length();
        int pl=p.length();
        char S[] = new char[sl];
        char P[] = new char[pl];

        for(int i=0;i<sl;i++){
            S[i]=s.charAt(i);
        }
        for(int i=0;i<pl;i++){
            P[i]=p.charAt(i);
        }
        int i,count=0;
        boolean t=false;
        for(i=0;i<sl;i++){
            count=0;
            for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            }
            if(count==pl){
                break;
            }
        }
        if(count==pl){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        String s=scan.next();
        String p=scan.next();

        int sl=s.length();
        int pl=p.length();
        char S[] = new char[sl];
        char P[] = new char[pl];

        for(int i=0;i<sl;i++){
            S[i]=s.charAt(i);
        }
        for(int i=0;i<pl;i++){
            P[i]=p.charAt(i);
        }
        int i,count=0;
        boolean t=false;
        for(i=0;i<sl;i++){
            count=0;
            for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            }
            if(count==pl){
                break;
            }
        }
        if(count==pl){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner scan = new Scanner(System.in);
        String s=scan.next();
        String p=scan.next();

        int sl=s.length();
        int pl=p.length();
        char S[] = new char[sl];
        char P[] = new char[pl];

        for(int i=0;i<sl;i++){
            S[i]=s.charAt(i);
        }
        for(int i=0;i<pl;i++){
            P[i]=p.charAt(i);
        }
        int i,count=0;
        boolean t=false;
        for(i=0;i<sl;i++){
            count=0;
            for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            }
            if(count==pl){
                break;
            }
        }
        if(count==pl){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s=scan.next(); s scan.next() scan.next scan String p=scan.next(); p scan.next() scan.next scan int sl=s.length(); sl s.length() s.length s int pl=p.length(); pl p.length() p.length p char S[] = new char[sl]; S new char[sl] sl char P[] = new char[pl]; P new char[pl] pl for(int i=0;i<sl;i++){
            S[i]=s.charAt(i);
        } int i=0; int i=0; i 0 i<sl i sl i++ i++ i {
            S[i]=s.charAt(i);
        } {
            S[i]=s.charAt(i);
        } S[i]=s.charAt(i) S[i] S i s.charAt(i) s.charAt s i for(int i=0;i<pl;i++){
            P[i]=p.charAt(i);
        } int i=0; int i=0; i 0 i<pl i pl i++ i++ i {
            P[i]=p.charAt(i);
        } {
            P[i]=p.charAt(i);
        } P[i]=p.charAt(i) P[i] P i p.charAt(i) p.charAt p i int i i count=0; count 0 boolean t=false; t false for(i=0;i<sl;i++){
            count=0;
            for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            }
            if(count==pl){
                break;
            }
        } i=0; i=0 i 0 i<sl i sl i++ i++ i {
            count=0;
            for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            }
            if(count==pl){
                break;
            }
        } {
            count=0;
            for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            }
            if(count==pl){
                break;
            }
        } count=0 count 0 for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            } int j=0; int j=0; j 0 j<pl j pl j++ j++ j {
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            } {
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            } if(S[(i+j)%sl]==P[j]){
                    count++;
                } S[(i+j)%sl]==P[j] S[(i+j)%sl] S (i+j)%sl (i+j) i j sl P[j] P j {
                    count++;
                } count++ count if(count==pl){
                break;
            } count==pl count pl {
                break;
            } break; if(count==pl){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } count==pl count pl {
            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[]){
        Scanner scan = new Scanner(System.in);
        String s=scan.next();
        String p=scan.next();

        int sl=s.length();
        int pl=p.length();
        char S[] = new char[sl];
        char P[] = new char[pl];

        for(int i=0;i<sl;i++){
            S[i]=s.charAt(i);
        }
        for(int i=0;i<pl;i++){
            P[i]=p.charAt(i);
        }
        int i,count=0;
        boolean t=false;
        for(i=0;i<sl;i++){
            count=0;
            for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            }
            if(count==pl){
                break;
            }
        }
        if(count==pl){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        String s=scan.next();
        String p=scan.next();

        int sl=s.length();
        int pl=p.length();
        char S[] = new char[sl];
        char P[] = new char[pl];

        for(int i=0;i<sl;i++){
            S[i]=s.charAt(i);
        }
        for(int i=0;i<pl;i++){
            P[i]=p.charAt(i);
        }
        int i,count=0;
        boolean t=false;
        for(i=0;i<sl;i++){
            count=0;
            for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            }
            if(count==pl){
                break;
            }
        }
        if(count==pl){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        String s=scan.next();
        String p=scan.next();

        int sl=s.length();
        int pl=p.length();
        char S[] = new char[sl];
        char P[] = new char[pl];

        for(int i=0;i<sl;i++){
            S[i]=s.charAt(i);
        }
        for(int i=0;i<pl;i++){
            P[i]=p.charAt(i);
        }
        int i,count=0;
        boolean t=false;
        for(i=0;i<sl;i++){
            count=0;
            for(int j=0;j<pl;j++){
                if(S[(i+j)%sl]==P[j]){
                    count++;
                }
            }
            if(count==pl){
                break;
            }
        }
        if(count==pl){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

