import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

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

        s += s.substring(0, p.length());

        System.out.println((s.contains(p))? "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 = sc.next();
        String p = sc.next();

        s += s.substring(0, p.length());

        System.out.println((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();

        s += s.substring(0, p.length());

        System.out.println((s.contains(p))? "Yes" : "No");
    } main {
        Scanner sc = new Scanner(System.in);

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

        s += s.substring(0, p.length());

        System.out.println((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 s += s.substring(0, p.length()) s s.substring(0, p.length()) s.substring s 0 p.length() p.length p System.out.println((s.contains(p))? "Yes" : "No") System.out.println System.out System System.out (s.contains(p))? "Yes" : "No" (s.contains(p)) s.contains 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();

        s += s.substring(0, p.length());

        System.out.println((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();

        s += s.substring(0, p.length());

        System.out.println((s.contains(p))? "Yes" : "No");
    }
} 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 p = sc.next();

        s += s.substring(0, p.length());

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