import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    Scanner sc = new Scanner(System.in);

    void solve() {
        String s = sc.nextLine();
        String p = sc.nextLine();
        String[] ring = (s + s).split("");
        String[] pArr = p.split("");
        for (int i = 0; i < ring.length; ++i) {
            boolean f = true;
            int cnt = 0;
            for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            }
            if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}



 import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    Scanner sc = new Scanner(System.in);

    void solve() {
        String s = sc.nextLine();
        String p = sc.nextLine();
        String[] ring = (s + s).split("");
        String[] pArr = p.split("");
        for (int i = 0; i < ring.length; ++i) {
            boolean f = true;
            int cnt = 0;
            for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            }
            if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args void solve() {
        String s = sc.nextLine();
        String p = sc.nextLine();
        String[] ring = (s + s).split("");
        String[] pArr = p.split("");
        for (int i = 0; i < ring.length; ++i) {
            boolean f = true;
            int cnt = 0;
            for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            }
            if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } solve {
        String s = sc.nextLine();
        String p = sc.nextLine();
        String[] ring = (s + s).split("");
        String[] pArr = p.split("");
        for (int i = 0; i < ring.length; ++i) {
            boolean f = true;
            int cnt = 0;
            for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            }
            if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc String[] ring = (s + s).split(""); ring (s + s).split("") (s + s).split (s + s) s s "" String[] pArr = p.split(""); pArr p.split("") p.split p "" for (int i = 0; i < ring.length; ++i) {
            boolean f = true;
            int cnt = 0;
            for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            }
            if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            }
        } int i = 0; int i = 0; i 0 i < ring.length i ring.length ring ring.length ++i ++i i {
            boolean f = true;
            int cnt = 0;
            for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            }
            if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            }
        } {
            boolean f = true;
            int cnt = 0;
            for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            }
            if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            }
        } boolean f = true; f true int cnt = 0; cnt 0 for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            } int j = 0; int j = 0; j 0 j < pArr.length && i + j < ring.length j < pArr.length j pArr.length pArr pArr.length i + j < ring.length i + j i j ring.length ring ring.length ++j ++j j {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            } {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            } if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                } !ring[i + j].equals(pArr[j]) ring[i + j].equals(pArr[j]) ring[i + j].equals ring[i + j] ring i + j i j pArr[j] pArr j {
                    f = false;
                    break;
                } f = false f false break; cnt++ cnt if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            } f && cnt == p.length() f cnt == p.length() cnt p.length() p.length p {
                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" public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    Scanner sc = new Scanner(System.in);

    void solve() {
        String s = sc.nextLine();
        String p = sc.nextLine();
        String[] ring = (s + s).split("");
        String[] pArr = p.split("");
        for (int i = 0; i < ring.length; ++i) {
            boolean f = true;
            int cnt = 0;
            for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            }
            if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    Scanner sc = new Scanner(System.in);

    void solve() {
        String s = sc.nextLine();
        String p = sc.nextLine();
        String[] ring = (s + s).split("");
        String[] pArr = p.split("");
        for (int i = 0; i < ring.length; ++i) {
            boolean f = true;
            int cnt = 0;
            for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            }
            if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    Scanner sc = new Scanner(System.in);

    void solve() {
        String s = sc.nextLine();
        String p = sc.nextLine();
        String[] ring = (s + s).split("");
        String[] pArr = p.split("");
        for (int i = 0; i < ring.length; ++i) {
            boolean f = true;
            int cnt = 0;
            for (int j = 0; j < pArr.length && i + j < ring.length; ++j) {
                if (!ring[i + j].equals(pArr[j])) {
                    f = false;
                    break;
                }
                cnt++;
            }
            if (f && cnt == p.length()) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}




