import java.util.Scanner;

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

        String a = sc.next().trim();
        String b = sc.next().trim();

        char[] left  = a.toCharArray();
        char[] right = b.toCharArray();

        boolean eq = false;

        for (int i = 0; i < left.length; i++) {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        }

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

    private static void rotate(char[] ch) {
        char tmp = ch[0];

        for (int i = 0; i < ch.length - 1; i++) {
            ch[i] = ch[i + 1];
        }

        ch[ch.length - 1] = tmp;
    }

    private static boolean equals(char[] left, char[] right) {
        boolean res = true;

        for (int i = 0; i < left.length; i++) {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        }

        return res;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next().trim();
        String b = sc.next().trim();

        char[] left  = a.toCharArray();
        char[] right = b.toCharArray();

        boolean eq = false;

        for (int i = 0; i < left.length; i++) {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        }

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

    private static void rotate(char[] ch) {
        char tmp = ch[0];

        for (int i = 0; i < ch.length - 1; i++) {
            ch[i] = ch[i + 1];
        }

        ch[ch.length - 1] = tmp;
    }

    private static boolean equals(char[] left, char[] right) {
        boolean res = true;

        for (int i = 0; i < left.length; i++) {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        }

        return res;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next().trim();
        String b = sc.next().trim();

        char[] left  = a.toCharArray();
        char[] right = b.toCharArray();

        boolean eq = false;

        for (int i = 0; i < left.length; i++) {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        }

        System.out.println((eq ? "Yes" : "No"));
    } main {
        Scanner sc = new Scanner(System.in);

        String a = sc.next().trim();
        String b = sc.next().trim();

        char[] left  = a.toCharArray();
        char[] right = b.toCharArray();

        boolean eq = false;

        for (int i = 0; i < left.length; i++) {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        }

        System.out.println((eq ? "Yes" : "No"));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next().trim(); a sc.next().trim() sc.next().trim sc.next() sc.next sc String b = sc.next().trim(); b sc.next().trim() sc.next().trim sc.next() sc.next sc char[] left  = a.toCharArray(); left a.toCharArray() a.toCharArray a char[] right = b.toCharArray(); right b.toCharArray() b.toCharArray b boolean eq = false; eq false for (int i = 0; i < left.length; i++) {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        } int i = 0; int i = 0; i 0 i < left.length i left.length left left.length i++ i++ i {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        } {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        } if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            } equals(left, right) equals left right {
                eq = true;
                break;
            } eq = true eq true break; {
                rotate(right);
            } rotate(right) rotate right System.out.println((eq ? "Yes" : "No")) System.out.println System.out System System.out (eq ? "Yes" : "No") eq "Yes" "No" String[] args args private static void rotate(char[] ch) {
        char tmp = ch[0];

        for (int i = 0; i < ch.length - 1; i++) {
            ch[i] = ch[i + 1];
        }

        ch[ch.length - 1] = tmp;
    } rotate {
        char tmp = ch[0];

        for (int i = 0; i < ch.length - 1; i++) {
            ch[i] = ch[i + 1];
        }

        ch[ch.length - 1] = tmp;
    } char tmp = ch[0]; tmp ch[0] ch 0 for (int i = 0; i < ch.length - 1; i++) {
            ch[i] = ch[i + 1];
        } int i = 0; int i = 0; i 0 i < ch.length - 1 i ch.length - 1 ch.length ch ch.length 1 i++ i++ i {
            ch[i] = ch[i + 1];
        } {
            ch[i] = ch[i + 1];
        } ch[i] = ch[i + 1] ch[i] ch i ch[i + 1] ch i + 1 i 1 ch[ch.length - 1] = tmp ch[ch.length - 1] ch ch.length - 1 ch.length ch ch.length 1 tmp char[] ch ch private static boolean equals(char[] left, char[] right) {
        boolean res = true;

        for (int i = 0; i < left.length; i++) {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        }

        return res;
    } equals {
        boolean res = true;

        for (int i = 0; i < left.length; i++) {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        }

        return res;
    } boolean res = true; res true for (int i = 0; i < left.length; i++) {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        } int i = 0; int i = 0; i 0 i < left.length i left.length left left.length i++ i++ i {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        } {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        } if (left[i] != right[i]) {
                res = false;
                break;
            } left[i] != right[i] left[i] left i right[i] right i {
                res = false;
                break;
            } res = false res false break; return res; res char[] left left char[] right right public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next().trim();
        String b = sc.next().trim();

        char[] left  = a.toCharArray();
        char[] right = b.toCharArray();

        boolean eq = false;

        for (int i = 0; i < left.length; i++) {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        }

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

    private static void rotate(char[] ch) {
        char tmp = ch[0];

        for (int i = 0; i < ch.length - 1; i++) {
            ch[i] = ch[i + 1];
        }

        ch[ch.length - 1] = tmp;
    }

    private static boolean equals(char[] left, char[] right) {
        boolean res = true;

        for (int i = 0; i < left.length; i++) {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        }

        return res;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next().trim();
        String b = sc.next().trim();

        char[] left  = a.toCharArray();
        char[] right = b.toCharArray();

        boolean eq = false;

        for (int i = 0; i < left.length; i++) {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        }

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

    private static void rotate(char[] ch) {
        char tmp = ch[0];

        for (int i = 0; i < ch.length - 1; i++) {
            ch[i] = ch[i + 1];
        }

        ch[ch.length - 1] = tmp;
    }

    private static boolean equals(char[] left, char[] right) {
        boolean res = true;

        for (int i = 0; i < left.length; i++) {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        }

        return res;
    }
} Main
import java.util.Scanner;

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

        String a = sc.next().trim();
        String b = sc.next().trim();

        char[] left  = a.toCharArray();
        char[] right = b.toCharArray();

        boolean eq = false;

        for (int i = 0; i < left.length; i++) {
            if (equals(left, right)) {
                eq = true;
                break;
            } else {
                rotate(right);
            }
        }

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

    private static void rotate(char[] ch) {
        char tmp = ch[0];

        for (int i = 0; i < ch.length - 1; i++) {
            ch[i] = ch[i + 1];
        }

        ch[ch.length - 1] = tmp;
    }

    private static boolean equals(char[] left, char[] right) {
        boolean res = true;

        for (int i = 0; i < left.length; i++) {
            if (left[i] != right[i]) {
                res = false;
                break;
            }
        }

        return res;
    }
}