import java.util.Scanner;

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

        StringBuilder s = new StringBuilder(scanner.nextLine());
        s.append(s);
        String p = scanner.nextLine();

        if(!s.toString().contains(p)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

        scanner.close();
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        StringBuilder s = new StringBuilder(scanner.nextLine());
        s.append(s);
        String p = scanner.nextLine();

        if(!s.toString().contains(p)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

        scanner.close();
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        StringBuilder s = new StringBuilder(scanner.nextLine());
        s.append(s);
        String p = scanner.nextLine();

        if(!s.toString().contains(p)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

        scanner.close();
    } main {
        Scanner scanner = new Scanner(System.in);

        StringBuilder s = new StringBuilder(scanner.nextLine());
        s.append(s);
        String p = scanner.nextLine();

        if(!s.toString().contains(p)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) StringBuilder s = new StringBuilder(scanner.nextLine()); s new StringBuilder(scanner.nextLine()) s.append(s) s.append s s String p = scanner.nextLine(); p scanner.nextLine() scanner.nextLine scanner if(!s.toString().contains(p)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        } !s.toString().contains(p) s.toString().contains(p) s.toString().contains s.toString() s.toString s p {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" scanner.close() scanner.close scanner String[] args args public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        StringBuilder s = new StringBuilder(scanner.nextLine());
        s.append(s);
        String p = scanner.nextLine();

        if(!s.toString().contains(p)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

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

        StringBuilder s = new StringBuilder(scanner.nextLine());
        s.append(s);
        String p = scanner.nextLine();

        if(!s.toString().contains(p)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

        scanner.close();
    }
} Main
import java.util.Scanner;

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

        StringBuilder s = new StringBuilder(scanner.nextLine());
        s.append(s);
        String p = scanner.nextLine();

        if(!s.toString().contains(p)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

        scanner.close();
    }
}

