import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();

        boolean res = false;
        for (int i = 0; i < s.length; i++) {

            char[] tmpChar = new char[s.length];
            for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            }
            tmpChar[0] = s[s.length-1];

            s = tmpChar;// 入れ替えをした結果を更新

            // 比較
            String tmpRes = new String(s);
            if (tmpRes.equals(t)) {
                res = true;
                break;
            }
        }

        System.out.println(res ? "Yes" : "No");
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();

        boolean res = false;
        for (int i = 0; i < s.length; i++) {

            char[] tmpChar = new char[s.length];
            for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            }
            tmpChar[0] = s[s.length-1];

            s = tmpChar;// 入れ替えをした結果を更新

            // 比較
            String tmpRes = new String(s);
            if (tmpRes.equals(t)) {
                res = true;
                break;
            }
        }

        System.out.println(res ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();

        boolean res = false;
        for (int i = 0; i < s.length; i++) {

            char[] tmpChar = new char[s.length];
            for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            }
            tmpChar[0] = s[s.length-1];

            s = tmpChar;// 入れ替えをした結果を更新

            // 比較
            String tmpRes = new String(s);
            if (tmpRes.equals(t)) {
                res = true;
                break;
            }
        }

        System.out.println(res ? "Yes" : "No");
    } main {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();

        boolean res = false;
        for (int i = 0; i < s.length; i++) {

            char[] tmpChar = new char[s.length];
            for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            }
            tmpChar[0] = s[s.length-1];

            s = tmpChar;// 入れ替えをした結果を更新

            // 比較
            String tmpRes = new String(s);
            if (tmpRes.equals(t)) {
                res = true;
                break;
            }
        }

        System.out.println(res ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc boolean res = false; res false for (int i = 0; i < s.length; i++) {

            char[] tmpChar = new char[s.length];
            for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            }
            tmpChar[0] = s[s.length-1];

            s = tmpChar;// 入れ替えをした結果を更新

            // 比較
            String tmpRes = new String(s);
            if (tmpRes.equals(t)) {
                res = true;
                break;
            }
        } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {

            char[] tmpChar = new char[s.length];
            for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            }
            tmpChar[0] = s[s.length-1];

            s = tmpChar;// 入れ替えをした結果を更新

            // 比較
            String tmpRes = new String(s);
            if (tmpRes.equals(t)) {
                res = true;
                break;
            }
        } {

            char[] tmpChar = new char[s.length];
            for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            }
            tmpChar[0] = s[s.length-1];

            s = tmpChar;// 入れ替えをした結果を更新

            // 比較
            String tmpRes = new String(s);
            if (tmpRes.equals(t)) {
                res = true;
                break;
            }
        } char[] tmpChar = new char[s.length]; tmpChar new char[s.length] s.length s s.length for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            } int j = 0; int j = 0; j 0 j < s.length - 1 j s.length - 1 s.length s s.length 1 j++ j++ j {
                tmpChar[j+1] = s[j];
            } {
                tmpChar[j+1] = s[j];
            } tmpChar[j+1] = s[j] tmpChar[j+1] tmpChar j+1 j 1 s[j] s j tmpChar[0] = s[s.length-1] tmpChar[0] tmpChar 0 s[s.length-1] s s.length-1 s.length s s.length 1 s = tmpChar s tmpChar String tmpRes = new String(s); tmpRes new String(s) if (tmpRes.equals(t)) {
                res = true;
                break;
            } tmpRes.equals(t) tmpRes.equals tmpRes t {
                res = true;
                break;
            } res = true res true break; System.out.println(res ? "Yes" : "No") System.out.println System.out System System.out res ? "Yes" : "No" res "Yes" "No" String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();

        boolean res = false;
        for (int i = 0; i < s.length; i++) {

            char[] tmpChar = new char[s.length];
            for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            }
            tmpChar[0] = s[s.length-1];

            s = tmpChar;// 入れ替えをした結果を更新

            // 比較
            String tmpRes = new String(s);
            if (tmpRes.equals(t)) {
                res = true;
                break;
            }
        }

        System.out.println(res ? "Yes" : "No");
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();

        boolean res = false;
        for (int i = 0; i < s.length; i++) {

            char[] tmpChar = new char[s.length];
            for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            }
            tmpChar[0] = s[s.length-1];

            s = tmpChar;// 入れ替えをした結果を更新

            // 比較
            String tmpRes = new String(s);
            if (tmpRes.equals(t)) {
                res = true;
                break;
            }
        }

        System.out.println(res ? "Yes" : "No");
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();

        boolean res = false;
        for (int i = 0; i < s.length; i++) {

            char[] tmpChar = new char[s.length];
            for (int j = 0; j < s.length - 1; j++) {
                tmpChar[j+1] = s[j];
            }
            tmpChar[0] = s[s.length-1];

            s = tmpChar;// 入れ替えをした結果を更新

            // 比較
            String tmpRes = new String(s);
            if (tmpRes.equals(t)) {
                res = true;
                break;
            }
        }

        System.out.println(res ? "Yes" : "No");
    }
}
