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