import java.util.InputMismatchException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		try{
			while(scan.hasNextLine()) {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			}
			scan.close();
		}catch(InputMismatchException e){
			System.out.println("入力しなおしてください");
		}
		}
} import java.util.InputMismatchException; InputMismatchException java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		try{
			while(scan.hasNextLine()) {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			}
			scan.close();
		}catch(InputMismatchException e){
			System.out.println("入力しなおしてください");
		}
		}
} Main public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		try{
			while(scan.hasNextLine()) {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			}
			scan.close();
		}catch(InputMismatchException e){
			System.out.println("入力しなおしてください");
		}
		} main {
		Scanner scan=new Scanner(System.in);
		try{
			while(scan.hasNextLine()) {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			}
			scan.close();
		}catch(InputMismatchException e){
			System.out.println("入力しなおしてください");
		}
		} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) try{
			while(scan.hasNextLine()) {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			}
			scan.close();
		}catch(InputMismatchException e){
			System.out.println("入力しなおしてください");
		} catch(InputMismatchException e){
			System.out.println("入力しなおしてください");
		} InputMismatchException e {
			System.out.println("入力しなおしてください");
		} System.out.println("入力しなおしてください") System.out.println System.out System System.out "入力しなおしてください" {
			while(scan.hasNextLine()) {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			}
			scan.close();
		} while(scan.hasNextLine()) {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			} scan.hasNextLine() scan.hasNextLine scan {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			} String str1=scan.nextLine(); str1 scan.nextLine() scan.nextLine scan String str2=scan.nextLine(); str2 scan.nextLine() scan.nextLine scan str1=str1+str1 str1 str1+str1 str1 str1 int result=str1.indexOf(str2); result str1.indexOf(str2) str1.indexOf str1 str2 if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				} result!=-1 result -1 1 {
					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" scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		try{
			while(scan.hasNextLine()) {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			}
			scan.close();
		}catch(InputMismatchException e){
			System.out.println("入力しなおしてください");
		}
		}
} public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		try{
			while(scan.hasNextLine()) {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			}
			scan.close();
		}catch(InputMismatchException e){
			System.out.println("入力しなおしてください");
		}
		}
} Main
import java.util.InputMismatchException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		try{
			while(scan.hasNextLine()) {
				String str1=scan.nextLine();
				String str2=scan.nextLine();
				str1=str1+str1;
				int result=str1.indexOf(str2);
				if(result!=-1) {
					System.out.println("Yes");
				}
				else{
					System.out.println("No");
				}
			}
			scan.close();
		}catch(InputMismatchException e){
			System.out.println("入力しなおしてください");
		}
		}
}
