import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = new String[]{sc.next(), sc.next()};
        System.out.println((s[0] + s[0]).contains(s[1]) ? "Yes" : "No");
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = new String[]{sc.next(), sc.next()};
        System.out.println((s[0] + s[0]).contains(s[1]) ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = new String[]{sc.next(), sc.next()};
        System.out.println((s[0] + s[0]).contains(s[1]) ? "Yes" : "No");
    } main {
        Scanner sc = new Scanner(System.in);
        String[] s = new String[]{sc.next(), sc.next()};
        System.out.println((s[0] + s[0]).contains(s[1]) ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] s = new String[]{sc.next(), sc.next()}; s new String[]{sc.next(), sc.next()} System.out.println((s[0] + s[0]).contains(s[1]) ? "Yes" : "No") System.out.println System.out System System.out (s[0] + s[0]).contains(s[1]) ? "Yes" : "No" (s[0] + s[0]).contains(s[1]) (s[0] + s[0]).contains (s[0] + s[0]) s[0] s 0 s[0] s 0 s[1] s 1 "Yes" "No" String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = new String[]{sc.next(), sc.next()};
        System.out.println((s[0] + s[0]).contains(s[1]) ? "Yes" : "No");
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = new String[]{sc.next(), sc.next()};
        System.out.println((s[0] + s[0]).contains(s[1]) ? "Yes" : "No");
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = new String[]{sc.next(), sc.next()};
        System.out.println((s[0] + s[0]).contains(s[1]) ? "Yes" : "No");
    }
}