import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		char[] s = br.readLine().toLowerCase().toCharArray();
		char[] p = br.readLine().toLowerCase().toCharArray();
		boolean isExist = false;
		boolean isCheck;

		for (int i = 0; i < s.length; i++) {
			isCheck = false;
			
			if (p[0] == s[i]) isCheck = true;
			
			for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			}
		}
		
		System.out.println(isExist ? "Yes" : "No"); 
	}
} import java.io.*; io.* java public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		char[] s = br.readLine().toLowerCase().toCharArray();
		char[] p = br.readLine().toLowerCase().toCharArray();
		boolean isExist = false;
		boolean isCheck;

		for (int i = 0; i < s.length; i++) {
			isCheck = false;
			
			if (p[0] == s[i]) isCheck = true;
			
			for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			}
		}
		
		System.out.println(isExist ? "Yes" : "No"); 
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		char[] s = br.readLine().toLowerCase().toCharArray();
		char[] p = br.readLine().toLowerCase().toCharArray();
		boolean isExist = false;
		boolean isCheck;

		for (int i = 0; i < s.length; i++) {
			isCheck = false;
			
			if (p[0] == s[i]) isCheck = true;
			
			for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			}
		}
		
		System.out.println(isExist ? "Yes" : "No"); 
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		char[] s = br.readLine().toLowerCase().toCharArray();
		char[] p = br.readLine().toLowerCase().toCharArray();
		boolean isExist = false;
		boolean isCheck;

		for (int i = 0; i < s.length; i++) {
			isCheck = false;
			
			if (p[0] == s[i]) isCheck = true;
			
			for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			}
		}
		
		System.out.println(isExist ? "Yes" : "No"); 
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) char[] s = br.readLine().toLowerCase().toCharArray(); s br.readLine().toLowerCase().toCharArray() br.readLine().toLowerCase().toCharArray br.readLine().toLowerCase() br.readLine().toLowerCase br.readLine() br.readLine br char[] p = br.readLine().toLowerCase().toCharArray(); p br.readLine().toLowerCase().toCharArray() br.readLine().toLowerCase().toCharArray br.readLine().toLowerCase() br.readLine().toLowerCase br.readLine() br.readLine br boolean isExist = false; isExist false boolean isCheck; isCheck for (int i = 0; i < s.length; i++) {
			isCheck = false;
			
			if (p[0] == s[i]) isCheck = true;
			
			for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			}
		} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
			isCheck = false;
			
			if (p[0] == s[i]) isCheck = true;
			
			for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			}
		} {
			isCheck = false;
			
			if (p[0] == s[i]) isCheck = true;
			
			for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			}
		} isCheck = false isCheck false if (p[0] == s[i]) isCheck = true; p[0] == s[i] p[0] p 0 s[i] s i isCheck = true isCheck true for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			} int j = i, ip = 0; int j = i j i ip = 0; ip 0 isCheck && j <= s.length && ip < p.length isCheck && j <= s.length && ip < p.length isCheck j <= s.length j s.length s s.length ip < p.length ip p.length p p.length j++, ip++ j++ j ip++ ip {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			} {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			} if (j == s.length)		j = 0; j == s.length j s.length s s.length j = 0 j 0 if (s[j] != p[ip])		break; s[j] != p[ip] s[j] s j p[ip] p ip break; if (ip == p.length - 1)	isExist = true; ip == p.length - 1 ip p.length - 1 p.length p p.length 1 isExist = true isExist true System.out.println(isExist ? "Yes" : "No") System.out.println System.out System System.out isExist ? "Yes" : "No" isExist "Yes" "No" String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		char[] s = br.readLine().toLowerCase().toCharArray();
		char[] p = br.readLine().toLowerCase().toCharArray();
		boolean isExist = false;
		boolean isCheck;

		for (int i = 0; i < s.length; i++) {
			isCheck = false;
			
			if (p[0] == s[i]) isCheck = true;
			
			for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			}
		}
		
		System.out.println(isExist ? "Yes" : "No"); 
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		char[] s = br.readLine().toLowerCase().toCharArray();
		char[] p = br.readLine().toLowerCase().toCharArray();
		boolean isExist = false;
		boolean isCheck;

		for (int i = 0; i < s.length; i++) {
			isCheck = false;
			
			if (p[0] == s[i]) isCheck = true;
			
			for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			}
		}
		
		System.out.println(isExist ? "Yes" : "No"); 
	}
} Main
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		char[] s = br.readLine().toLowerCase().toCharArray();
		char[] p = br.readLine().toLowerCase().toCharArray();
		boolean isExist = false;
		boolean isCheck;

		for (int i = 0; i < s.length; i++) {
			isCheck = false;
			
			if (p[0] == s[i]) isCheck = true;
			
			for (int j = i, ip = 0; isCheck && j <= s.length && ip < p.length; j++, ip++) {
				if (j == s.length)		j = 0;
				if (s[j] != p[ip])		break;
				if (ip == p.length - 1)	isExist = true;
			}
		}
		
		System.out.println(isExist ? "Yes" : "No"); 
	}
}