import java.util.HashMap;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.Collections;
import java.math.BigDecimal;

public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String s = sc.next();
        String p = sc.next();
        for (int i = 0; i < s.length(); i++) {
            s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
            if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} import java.util.HashMap; HashMap java.util import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util import java.util.regex.Pattern; Pattern java.util.regex import java.util.Collections; Collections java.util import java.math.BigDecimal; BigDecimal java.math public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String s = sc.next();
        String p = sc.next();
        for (int i = 0; i < s.length(); i++) {
            s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
            if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main public static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) throws Exception {
        String s = sc.next();
        String p = sc.next();
        for (int i = 0; i < s.length(); i++) {
            s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
            if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } main {
        String s = sc.next();
        String p = sc.next();
        for (int i = 0; i < s.length(); i++) {
            s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
            if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } String s = sc.next(); s sc.next() sc.next sc String p = sc.next(); p sc.next() sc.next sc for (int i = 0; i < s.length(); i++) {
            s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
            if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
            if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            }
        } {
            s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
            if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            }
        } s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1) s s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1) s.substring(s.length()-1, s.length()) s.substring s s.length()-1 s.length() s.length s 1 s.length() s.length s s.substring(0, s.length()-1) s.substring s 0 s.length()-1 s.length() s.length s 1 if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            } s.indexOf(p) != -1 s.indexOf(p) s.indexOf s p -1 1 {
                System.out.println("Yes");
                return;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String s = sc.next();
        String p = sc.next();
        for (int i = 0; i < s.length(); i++) {
            s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
            if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String s = sc.next();
        String p = sc.next();
        for (int i = 0; i < s.length(); i++) {
            s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
            if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.Collections;
import java.math.BigDecimal;

public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String s = sc.next();
        String p = sc.next();
        for (int i = 0; i < s.length(); i++) {
            s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
            if (s.indexOf(p) != -1) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}