import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String S = reader.next();
		String T = reader.next();
		String ans = "No";
		
		for (int i = 0; i < S.length(); i ++) {
			if (S.equals(T)) {
				ans = "Yes";
				break;
			}
			S = S.charAt(S.length()-1) + S.substring(0, S.length()-1);
		}
		

		reader.close();
		System.out.print(ans);
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String S = reader.next();
		String T = reader.next();
		String ans = "No";
		
		for (int i = 0; i < S.length(); i ++) {
			if (S.equals(T)) {
				ans = "Yes";
				break;
			}
			S = S.charAt(S.length()-1) + S.substring(0, S.length()-1);
		}
		

		reader.close();
		System.out.print(ans);
	}
} Main public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String S = reader.next();
		String T = reader.next();
		String ans = "No";
		
		for (int i = 0; i < S.length(); i ++) {
			if (S.equals(T)) {
				ans = "Yes";
				break;
			}
			S = S.charAt(S.length()-1) + S.substring(0, S.length()-1);
		}
		

		reader.close();
		System.out.print(ans);
	} main {
		Scanner reader = new Scanner(System.in);
		String S = reader.next();
		String T = reader.next();
		String ans = "No";
		
		for (int i = 0; i < S.length(); i ++) {
			if (S.equals(T)) {
				ans = "Yes";
				break;
			}
			S = S.charAt(S.length()-1) + S.substring(0, S.length()-1);
		}
		

		reader.close();
		System.out.print(ans);
	} Scanner reader = new Scanner(System.in); reader new Scanner(System.in) String S = reader.next(); S reader.next() reader.next reader String T = reader.next(); T reader.next() reader.next reader String ans = "No"; ans "No" for (int i = 0; i < S.length(); i ++) {
			if (S.equals(T)) {
				ans = "Yes";
				break;
			}
			S = S.charAt(S.length()-1) + S.substring(0, S.length()-1);
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i ++ i ++ i {
			if (S.equals(T)) {
				ans = "Yes";
				break;
			}
			S = S.charAt(S.length()-1) + S.substring(0, S.length()-1);
		} {
			if (S.equals(T)) {
				ans = "Yes";
				break;
			}
			S = S.charAt(S.length()-1) + S.substring(0, S.length()-1);
		} if (S.equals(T)) {
				ans = "Yes";
				break;
			} S.equals(T) S.equals S T {
				ans = "Yes";
				break;
			} ans = "Yes" ans "Yes" break; S = S.charAt(S.length()-1) + S.substring(0, S.length()-1) S S.charAt(S.length()-1) + S.substring(0, S.length()-1) S.charAt(S.length()-1) S.charAt S S.length()-1 S.length() S.length S 1 S.substring(0, S.length()-1) S.substring S 0 S.length()-1 S.length() S.length S 1 reader.close() reader.close reader System.out.print(ans) System.out.print System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String S = reader.next();
		String T = reader.next();
		String ans = "No";
		
		for (int i = 0; i < S.length(); i ++) {
			if (S.equals(T)) {
				ans = "Yes";
				break;
			}
			S = S.charAt(S.length()-1) + S.substring(0, S.length()-1);
		}
		

		reader.close();
		System.out.print(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String S = reader.next();
		String T = reader.next();
		String ans = "No";
		
		for (int i = 0; i < S.length(); i ++) {
			if (S.equals(T)) {
				ans = "Yes";
				break;
			}
			S = S.charAt(S.length()-1) + S.substring(0, S.length()-1);
		}
		

		reader.close();
		System.out.print(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String S = reader.next();
		String T = reader.next();
		String ans = "No";
		
		for (int i = 0; i < S.length(); i ++) {
			if (S.equals(T)) {
				ans = "Yes";
				break;
			}
			S = S.charAt(S.length()-1) + S.substring(0, S.length()-1);
		}
		

		reader.close();
		System.out.print(ans);
	}
}

