import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        String str = scn.next();
        str += str;
        System.out.println(str.indexOf(scn.next()) < 0 ? "No" : "Yes");
    }
} import java.util.*; util.* java public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        String str = scn.next();
        str += str;
        System.out.println(str.indexOf(scn.next()) < 0 ? "No" : "Yes");
    }
} Main private static final Scanner scn = new Scanner(System.in); scn new Scanner(System.in) public static void main(String[] args) {
        String str = scn.next();
        str += str;
        System.out.println(str.indexOf(scn.next()) < 0 ? "No" : "Yes");
    } main {
        String str = scn.next();
        str += str;
        System.out.println(str.indexOf(scn.next()) < 0 ? "No" : "Yes");
    } String str = scn.next(); str scn.next() scn.next scn str += str str str System.out.println(str.indexOf(scn.next()) < 0 ? "No" : "Yes") System.out.println System.out System System.out str.indexOf(scn.next()) < 0 ? "No" : "Yes" str.indexOf(scn.next()) < 0 str.indexOf(scn.next()) str.indexOf str scn.next() scn.next scn 0 "No" "Yes" String[] args args public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        String str = scn.next();
        str += str;
        System.out.println(str.indexOf(scn.next()) < 0 ? "No" : "Yes");
    }
} public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        String str = scn.next();
        str += str;
        System.out.println(str.indexOf(scn.next()) < 0 ? "No" : "Yes");
    }
} Main
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        String str = scn.next();
        str += str;
        System.out.println(str.indexOf(scn.next()) < 0 ? "No" : "Yes");
    }
}