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