
import java.util.Arrays;
import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        try {
            String s = scanner.next();
            String s2 = s + s;
            String p = scanner.next();
            if (s2.contains(p)){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
           /* for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i)==p.charAt(i)){

                }
            }*/

        } catch (Exception e) {

        } finally {

        }

    }

}

 import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util import java.util.regex.Pattern; Pattern java.util.regex public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        try {
            String s = scanner.next();
            String s2 = s + s;
            String p = scanner.next();
            if (s2.contains(p)){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
           /* for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i)==p.charAt(i)){

                }
            }*/

        } catch (Exception e) {

        } finally {

        }

    }

} Main public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        try {
            String s = scanner.next();
            String s2 = s + s;
            String p = scanner.next();
            if (s2.contains(p)){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
           /* for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i)==p.charAt(i)){

                }
            }*/

        } catch (Exception e) {

        } finally {

        }

    } main {

        Scanner scanner = new Scanner(System.in);
        try {
            String s = scanner.next();
            String s2 = s + s;
            String p = scanner.next();
            if (s2.contains(p)){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
           /* for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i)==p.charAt(i)){

                }
            }*/

        } catch (Exception e) {

        } finally {

        }

    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) try {
            String s = scanner.next();
            String s2 = s + s;
            String p = scanner.next();
            if (s2.contains(p)){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
           /* for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i)==p.charAt(i)){

                }
            }*/

        } catch (Exception e) {

        } finally {

        } catch (Exception e) {

        } Exception e {

        } {

        } {
            String s = scanner.next();
            String s2 = s + s;
            String p = scanner.next();
            if (s2.contains(p)){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
           /* for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i)==p.charAt(i)){

                }
            }*/

        } String s = scanner.next(); s scanner.next() scanner.next scanner String s2 = s + s; s2 s + s s s String p = scanner.next(); p scanner.next() scanner.next scanner if (s2.contains(p)){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            } s2.contains(p) s2.contains s2 p {
                System.out.println("Yes");
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
                System.out.println("No");
            } 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 scanner = new Scanner(System.in);
        try {
            String s = scanner.next();
            String s2 = s + s;
            String p = scanner.next();
            if (s2.contains(p)){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
           /* for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i)==p.charAt(i)){

                }
            }*/

        } catch (Exception e) {

        } finally {

        }

    }

} public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        try {
            String s = scanner.next();
            String s2 = s + s;
            String p = scanner.next();
            if (s2.contains(p)){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
           /* for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i)==p.charAt(i)){

                }
            }*/

        } catch (Exception e) {

        } finally {

        }

    }

} Main

import java.util.Arrays;
import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        try {
            String s = scanner.next();
            String s2 = s + s;
            String p = scanner.next();
            if (s2.contains(p)){
                System.out.println("Yes");
            }else {
                System.out.println("No");
            }
           /* for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i)==p.charAt(i)){

                }
            }*/

        } catch (Exception e) {

        } finally {

        }

    }

}


