import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/*Atcoder用
 * 		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int a = Integer.parseInt(tmp[0]);
		int b = Integer.parseInt(tmp[1]);
		int c = Integer.parseInt(tmp[2]);


		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String get = br.readLine();
		char[] s = get.toCharArray();
		for(char c:s)System.out.println(c);

		List<Integer> ls = new ArrayList<Integer>();
		String[] tmp = br.readLine().split(" ");
		for (int n = 0; n < N; n++) {
			ls.add(Integer.parseInt(tmp[n]));
		}
 */

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String t = br.readLine();

		char[] S = s.toCharArray();
		char[] T = t.toCharArray();

		boolean isEqual = false;

		//O(S.len^2)
		for(int i = 0;i<S.length;i++){
			for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			}
			if(isEqual)break;
		}

		if(isEqual)System.out.println("Yes");
		else System.out.println("No");


	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String t = br.readLine();

		char[] S = s.toCharArray();
		char[] T = t.toCharArray();

		boolean isEqual = false;

		//O(S.len^2)
		for(int i = 0;i<S.length;i++){
			for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			}
			if(isEqual)break;
		}

		if(isEqual)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 s = br.readLine();
		String t = br.readLine();

		char[] S = s.toCharArray();
		char[] T = t.toCharArray();

		boolean isEqual = false;

		//O(S.len^2)
		for(int i = 0;i<S.length;i++){
			for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			}
			if(isEqual)break;
		}

		if(isEqual)System.out.println("Yes");
		else System.out.println("No");


	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String t = br.readLine();

		char[] S = s.toCharArray();
		char[] T = t.toCharArray();

		boolean isEqual = false;

		//O(S.len^2)
		for(int i = 0;i<S.length;i++){
			for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			}
			if(isEqual)break;
		}

		if(isEqual)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 s = br.readLine(); s br.readLine() br.readLine br String t = br.readLine(); t br.readLine() br.readLine br char[] S = s.toCharArray(); S s.toCharArray() s.toCharArray s char[] T = t.toCharArray(); T t.toCharArray() t.toCharArray t boolean isEqual = false; isEqual false for(int i = 0;i<S.length;i++){
			for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			}
			if(isEqual)break;
		} int i = 0; int i = 0; i 0 i<S.length i S.length S S.length i++ i++ i {
			for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			}
			if(isEqual)break;
		} {
			for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			}
			if(isEqual)break;
		} for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			} int j=0; int j=0; j 0 j<S.length j S.length S S.length j++ j++ j {
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			} {
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			} isEqual = true isEqual true if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				} S[(j+i)%S.length] != T[j] S[(j+i)%S.length] S (j+i)%S.length (j+i) j i S.length S S.length T[j] T j {
					isEqual = false;
					break;
				} isEqual = false isEqual false break; if(isEqual)break; isEqual break; if(isEqual)System.out.println("Yes");
		else System.out.println("No"); isEqual 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" String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String t = br.readLine();

		char[] S = s.toCharArray();
		char[] T = t.toCharArray();

		boolean isEqual = false;

		//O(S.len^2)
		for(int i = 0;i<S.length;i++){
			for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			}
			if(isEqual)break;
		}

		if(isEqual)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 s = br.readLine();
		String t = br.readLine();

		char[] S = s.toCharArray();
		char[] T = t.toCharArray();

		boolean isEqual = false;

		//O(S.len^2)
		for(int i = 0;i<S.length;i++){
			for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			}
			if(isEqual)break;
		}

		if(isEqual)System.out.println("Yes");
		else System.out.println("No");


	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/*Atcoder用
 * 		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		int a = Integer.parseInt(tmp[0]);
		int b = Integer.parseInt(tmp[1]);
		int c = Integer.parseInt(tmp[2]);


		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String get = br.readLine();
		char[] s = get.toCharArray();
		for(char c:s)System.out.println(c);

		List<Integer> ls = new ArrayList<Integer>();
		String[] tmp = br.readLine().split(" ");
		for (int n = 0; n < N; n++) {
			ls.add(Integer.parseInt(tmp[n]));
		}
 */

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String t = br.readLine();

		char[] S = s.toCharArray();
		char[] T = t.toCharArray();

		boolean isEqual = false;

		//O(S.len^2)
		for(int i = 0;i<S.length;i++){
			for(int j=0;j<S.length;j++){
				isEqual = true;
				if(S[(j+i)%S.length] != T[j]){
					isEqual = false;
					break;
				}

			}
			if(isEqual)break;
		}

		if(isEqual)System.out.println("Yes");
		else System.out.println("No");


	}
}