import java.util.*;

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

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String p = sc.next();

        System.out.println((s + s).contains(p) ? "Yes" : "No");
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String p = sc.next();

        System.out.println((s + s).contains(p) ? "Yes" : "No");
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String p = sc.next();

        System.out.println((s + s).contains(p) ? "Yes" : "No");
    } main {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String p = sc.next();

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

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String p = sc.next();

        System.out.println((s + s).contains(p) ? "Yes" : "No");
    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String p = sc.next();

        System.out.println((s + s).contains(p) ? "Yes" : "No");
    }
} Main
import java.util.*;

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

        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String p = sc.next();

        System.out.println((s + s).contains(p) ? "Yes" : "No");
    }
}

