import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		line1 = line1 + line1;
		if (line1.indexOf(line2) != -1) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} import java.io.*; io.* java import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		line1 = line1 + line1;
		if (line1.indexOf(line2) != -1) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		line1 = line1 + line1;
		if (line1.indexOf(line2) != -1) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} main { 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		line1 = line1 + line1;
		if (line1.indexOf(line2) != -1) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line1 = br.readLine(); line1 br.readLine() br.readLine br String line2 = br.readLine(); line2 br.readLine() br.readLine br line1 = line1 + line1 line1 line1 + line1 line1 line1 if (line1.indexOf(line2) != -1) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} line1.indexOf(line2) != -1 line1.indexOf(line2) line1.indexOf line1 line2 -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" String[] args args public class Main{
	public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		line1 = line1 + line1;
		if (line1.indexOf(line2) != -1) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} public class Main{
	public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		line1 = line1 + line1;
		if (line1.indexOf(line2) != -1) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} Main
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		line1 = line1 + line1;
		if (line1.indexOf(line2) != -1) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}