import java.sql.SQLOutput;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        boolean judge = false;
        String s = scan.nextLine();
        int len = s.length();
        s += s;
        String p = scan.nextLine();
        for (int i = 0; i < len; i++) {
            if (s.substring(i, i + p.length()).equals(p)) judge = true;
        }
        if (judge) System.out.println("Yes");
        else System.out.println("No");
    }
}
 import java.sql.SQLOutput; SQLOutput java.sql import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        boolean judge = false;
        String s = scan.nextLine();
        int len = s.length();
        s += s;
        String p = scan.nextLine();
        for (int i = 0; i < len; i++) {
            if (s.substring(i, i + p.length()).equals(p)) judge = true;
        }
        if (judge) System.out.println("Yes");
        else System.out.println("No");
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        boolean judge = false;
        String s = scan.nextLine();
        int len = s.length();
        s += s;
        String p = scan.nextLine();
        for (int i = 0; i < len; i++) {
            if (s.substring(i, i + p.length()).equals(p)) judge = true;
        }
        if (judge) System.out.println("Yes");
        else System.out.println("No");
    } main {
        Scanner scan = new Scanner(System.in);
        boolean judge = false;
        String s = scan.nextLine();
        int len = s.length();
        s += s;
        String p = scan.nextLine();
        for (int i = 0; i < len; i++) {
            if (s.substring(i, i + p.length()).equals(p)) judge = true;
        }
        if (judge) System.out.println("Yes");
        else System.out.println("No");
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) boolean judge = false; judge false String s = scan.nextLine(); s scan.nextLine() scan.nextLine scan int len = s.length(); len s.length() s.length s s += s s s String p = scan.nextLine(); p scan.nextLine() scan.nextLine scan for (int i = 0; i < len; i++) {
            if (s.substring(i, i + p.length()).equals(p)) judge = true;
        } int i = 0; int i = 0; i 0 i < len i len i++ i++ i {
            if (s.substring(i, i + p.length()).equals(p)) judge = true;
        } {
            if (s.substring(i, i + p.length()).equals(p)) judge = true;
        } if (s.substring(i, i + p.length()).equals(p)) judge = true; s.substring(i, i + p.length()).equals(p) s.substring(i, i + p.length()).equals s.substring(i, i + p.length()) s.substring s i i + p.length() i p.length() p.length p p judge = true judge true if (judge) System.out.println("Yes");
        else System.out.println("No"); judge System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        boolean judge = false;
        String s = scan.nextLine();
        int len = s.length();
        s += s;
        String p = scan.nextLine();
        for (int i = 0; i < len; i++) {
            if (s.substring(i, i + p.length()).equals(p)) judge = true;
        }
        if (judge) System.out.println("Yes");
        else System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        boolean judge = false;
        String s = scan.nextLine();
        int len = s.length();
        s += s;
        String p = scan.nextLine();
        for (int i = 0; i < len; i++) {
            if (s.substring(i, i + p.length()).equals(p)) judge = true;
        }
        if (judge) System.out.println("Yes");
        else System.out.println("No");
    }
} Main
import java.sql.SQLOutput;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        boolean judge = false;
        String s = scan.nextLine();
        int len = s.length();
        s += s;
        String p = scan.nextLine();
        for (int i = 0; i < len; i++) {
            if (s.substring(i, i + p.length()).equals(p)) judge = true;
        }
        if (judge) System.out.println("Yes");
        else System.out.println("No");
    }
}

