import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        String word = input.nextLine();
        String pattern = input.nextLine();
        word += word;
        if(word.contains(pattern))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        String word = input.nextLine();
        String pattern = input.nextLine();
        word += word;
        if(word.contains(pattern))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} Main public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        String word = input.nextLine();
        String pattern = input.nextLine();
        word += word;
        if(word.contains(pattern))
            System.out.println("Yes");
        else
            System.out.println("No");
    } main {
        Scanner input = new Scanner(System.in);
        String word = input.nextLine();
        String pattern = input.nextLine();
        word += word;
        if(word.contains(pattern))
            System.out.println("Yes");
        else
            System.out.println("No");
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) String word = input.nextLine(); word input.nextLine() input.nextLine input String pattern = input.nextLine(); pattern input.nextLine() input.nextLine input word += word word word if(word.contains(pattern))
            System.out.println("Yes");
        else
            System.out.println("No"); word.contains(pattern) word.contains word pattern 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 input = new Scanner(System.in);
        String word = input.nextLine();
        String pattern = input.nextLine();
        word += word;
        if(word.contains(pattern))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} public class Main{
    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        String word = input.nextLine();
        String pattern = input.nextLine();
        word += word;
        if(word.contains(pattern))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        String word = input.nextLine();
        String pattern = input.nextLine();
        word += word;
        if(word.contains(pattern))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}
