import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanNumber = new Scanner(System.in);

        String S = scanNumber.next();

        String T = scanNumber.next();

        scanNumber.close();

        char[] charS = S.toCharArray();
        char[] charSalfa = S.toCharArray();
        char[] charT = T.toCharArray();

        String answer = "No";

        char work = ' ';

        for(int i = 0; i < T.length() ; i++){
            work = charS[0];
            for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            }
            charS[T.length() -1] = work;
            if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            }

        }

        System.out.print(answer);

    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner scanNumber = new Scanner(System.in);

        String S = scanNumber.next();

        String T = scanNumber.next();

        scanNumber.close();

        char[] charS = S.toCharArray();
        char[] charSalfa = S.toCharArray();
        char[] charT = T.toCharArray();

        String answer = "No";

        char work = ' ';

        for(int i = 0; i < T.length() ; i++){
            work = charS[0];
            for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            }
            charS[T.length() -1] = work;
            if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            }

        }

        System.out.print(answer);

    }
} Main public static void main(String[] args) {

        Scanner scanNumber = new Scanner(System.in);

        String S = scanNumber.next();

        String T = scanNumber.next();

        scanNumber.close();

        char[] charS = S.toCharArray();
        char[] charSalfa = S.toCharArray();
        char[] charT = T.toCharArray();

        String answer = "No";

        char work = ' ';

        for(int i = 0; i < T.length() ; i++){
            work = charS[0];
            for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            }
            charS[T.length() -1] = work;
            if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            }

        }

        System.out.print(answer);

    } main {

        Scanner scanNumber = new Scanner(System.in);

        String S = scanNumber.next();

        String T = scanNumber.next();

        scanNumber.close();

        char[] charS = S.toCharArray();
        char[] charSalfa = S.toCharArray();
        char[] charT = T.toCharArray();

        String answer = "No";

        char work = ' ';

        for(int i = 0; i < T.length() ; i++){
            work = charS[0];
            for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            }
            charS[T.length() -1] = work;
            if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            }

        }

        System.out.print(answer);

    } Scanner scanNumber = new Scanner(System.in); scanNumber new Scanner(System.in) String S = scanNumber.next(); S scanNumber.next() scanNumber.next scanNumber String T = scanNumber.next(); T scanNumber.next() scanNumber.next scanNumber scanNumber.close() scanNumber.close scanNumber char[] charS = S.toCharArray(); charS S.toCharArray() S.toCharArray S char[] charSalfa = S.toCharArray(); charSalfa S.toCharArray() S.toCharArray S char[] charT = T.toCharArray(); charT T.toCharArray() T.toCharArray T String answer = "No"; answer "No" char work = ' '; work ' ' for(int i = 0; i < T.length() ; i++){
            work = charS[0];
            for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            }
            charS[T.length() -1] = work;
            if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            }

        } int i = 0; int i = 0; i 0 i < T.length() i T.length() T.length T i++ i++ i {
            work = charS[0];
            for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            }
            charS[T.length() -1] = work;
            if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            }

        } {
            work = charS[0];
            for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            }
            charS[T.length() -1] = work;
            if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            }

        } work = charS[0] work charS[0] charS 0 for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            } int j=0; int j=0; j 0 j<T.length()-1 j T.length()-1 T.length() T.length T 1 j++ j++ j {
                charS[j] = charS[j + 1];
            } {
                charS[j] = charS[j + 1];
            } charS[j] = charS[j + 1] charS[j] charS j charS[j + 1] charS j + 1 j 1 charS[T.length() -1] = work charS[T.length() -1] charS T.length() -1 T.length() T.length T 1 work if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            } Arrays.equals(charS, charT) Arrays.equals Arrays charS charT {
                answer = "Yes";
                break;
            } answer = "Yes" answer "Yes" break; System.out.print(answer) System.out.print System.out System System.out answer String[] args args public class Main {

    public static void main(String[] args) {

        Scanner scanNumber = new Scanner(System.in);

        String S = scanNumber.next();

        String T = scanNumber.next();

        scanNumber.close();

        char[] charS = S.toCharArray();
        char[] charSalfa = S.toCharArray();
        char[] charT = T.toCharArray();

        String answer = "No";

        char work = ' ';

        for(int i = 0; i < T.length() ; i++){
            work = charS[0];
            for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            }
            charS[T.length() -1] = work;
            if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            }

        }

        System.out.print(answer);

    }
} public class Main {

    public static void main(String[] args) {

        Scanner scanNumber = new Scanner(System.in);

        String S = scanNumber.next();

        String T = scanNumber.next();

        scanNumber.close();

        char[] charS = S.toCharArray();
        char[] charSalfa = S.toCharArray();
        char[] charT = T.toCharArray();

        String answer = "No";

        char work = ' ';

        for(int i = 0; i < T.length() ; i++){
            work = charS[0];
            for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            }
            charS[T.length() -1] = work;
            if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            }

        }

        System.out.print(answer);

    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanNumber = new Scanner(System.in);

        String S = scanNumber.next();

        String T = scanNumber.next();

        scanNumber.close();

        char[] charS = S.toCharArray();
        char[] charSalfa = S.toCharArray();
        char[] charT = T.toCharArray();

        String answer = "No";

        char work = ' ';

        for(int i = 0; i < T.length() ; i++){
            work = charS[0];
            for(int j=0; j<T.length()-1 ; j++){
                charS[j] = charS[j + 1];
            }
            charS[T.length() -1] = work;
            if(Arrays.equals(charS, charT)){
                answer = "Yes";
                break;
            }

        }

        System.out.print(answer);

    }
}
