import java.util.*;
import java.text.*;

class Main {
    public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        s = s + s;
        System.out.println(s.indexOf(p) >=0 ? "Yes" : "No");
    }
} import java.util.*; util.* java import java.text.*; text.* java class Main {
    public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        s = s + s;
        System.out.println(s.indexOf(p) >=0 ? "Yes" : "No");
    }
} Main public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        s = s + s;
        System.out.println(s.indexOf(p) >=0 ? "Yes" : "No");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        s = s + s;
        System.out.println(s.indexOf(p) >=0 ? "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 s = s + s s s + s s s System.out.println(s.indexOf(p) >=0 ? "Yes" : "No") System.out.println System.out System System.out s.indexOf(p) >=0 ? "Yes" : "No" s.indexOf(p) >=0 s.indexOf(p) s.indexOf s p 0 "Yes" "No" String[]args args
import java.util.*;
import java.text.*;

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