import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        boolean ok = false;
        for (int i = 0; i < S.length(); i++) {
            String p1 = S.substring(0, i);
            String p2 = S.substring(i);
            if (T.equals(p2 + p1)) {
                ok = true;
                break;
            }
        }
        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        boolean ok = false;
        for (int i = 0; i < S.length(); i++) {
            String p1 = S.substring(0, i);
            String p2 = S.substring(i);
            if (T.equals(p2 + p1)) {
                ok = true;
                break;
            }
        }
        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        boolean ok = false;
        for (int i = 0; i < S.length(); i++) {
            String p1 = S.substring(0, i);
            String p2 = S.substring(i);
            if (T.equals(p2 + p1)) {
                ok = true;
                break;
            }
        }
        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        boolean ok = false;
        for (int i = 0; i < S.length(); i++) {
            String p1 = S.substring(0, i);
            String p2 = S.substring(i);
            if (T.equals(p2 + p1)) {
                ok = true;
                break;
            }
        }
        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc boolean ok = false; ok false for (int i = 0; i < S.length(); i++) {
            String p1 = S.substring(0, i);
            String p2 = S.substring(i);
            if (T.equals(p2 + p1)) {
                ok = true;
                break;
            }
        } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
            String p1 = S.substring(0, i);
            String p2 = S.substring(i);
            if (T.equals(p2 + p1)) {
                ok = true;
                break;
            }
        } {
            String p1 = S.substring(0, i);
            String p2 = S.substring(i);
            if (T.equals(p2 + p1)) {
                ok = true;
                break;
            }
        } String p1 = S.substring(0, i); p1 S.substring(0, i) S.substring S 0 i String p2 = S.substring(i); p2 S.substring(i) S.substring S i if (T.equals(p2 + p1)) {
                ok = true;
                break;
            } T.equals(p2 + p1) T.equals T p2 + p1 p2 p1 {
                ok = true;
                break;
            } ok = true ok true break; if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } ok {
            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" sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        boolean ok = false;
        for (int i = 0; i < S.length(); i++) {
            String p1 = S.substring(0, i);
            String p2 = S.substring(i);
            if (T.equals(p2 + p1)) {
                ok = true;
                break;
            }
        }
        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        boolean ok = false;
        for (int i = 0; i < S.length(); i++) {
            String p1 = S.substring(0, i);
            String p2 = S.substring(i);
            if (T.equals(p2 + p1)) {
                ok = true;
                break;
            }
        }
        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        boolean ok = false;
        for (int i = 0; i < S.length(); i++) {
            String p1 = S.substring(0, i);
            String p2 = S.substring(i);
            if (T.equals(p2 + p1)) {
                ok = true;
                break;
            }
        }
        if (ok) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        sc.close();
    }
}