
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		boolean check = false;
		for(int i = 0 ; i < s.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(0,1);
			if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			}
		}
		if(check == false) {
			System.out.println("No");
		}
	}
	public static boolean search(String s , String p) {
		for(int i = 0 ; i < p.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(i,i+1);
			if(!fs.equals(fp)){
				return false;
			}
		}

		return true;
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		boolean check = false;
		for(int i = 0 ; i < s.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(0,1);
			if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			}
		}
		if(check == false) {
			System.out.println("No");
		}
	}
	public static boolean search(String s , String p) {
		for(int i = 0 ; i < p.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(i,i+1);
			if(!fs.equals(fp)){
				return false;
			}
		}

		return true;
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		boolean check = false;
		for(int i = 0 ; i < s.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(0,1);
			if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			}
		}
		if(check == false) {
			System.out.println("No");
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		boolean check = false;
		for(int i = 0 ; i < s.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(0,1);
			if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			}
		}
		if(check == false) {
			System.out.println("No");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String p = scan.next(); p scan.next() scan.next scan boolean check = false; check false for(int i = 0 ; i < s.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(0,1);
			if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			}
		} int i = 0 ; int i = 0 ; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			String fs = s.substring(i,i+1);
			String fp = p.substring(0,1);
			if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			}
		} {
			String fs = s.substring(i,i+1);
			String fp = p.substring(0,1);
			if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			}
		} String fs = s.substring(i,i+1); fs s.substring(i,i+1) s.substring s i i+1 i 1 String fp = p.substring(0,1); fp p.substring(0,1) p.substring p 0 1 if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			} fs.equals(fp) fs.equals fs fp {
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			} String sort = s.substring(i,s.length()); sort s.substring(i,s.length()) s.substring s i s.length() s.length s String c = s.substring(0,i); c s.substring(0,i) s.substring s 0 i check = search(sort+c,p) check search(sort+c,p) search sort+c sort c p if(check == true) {
					System.out.println("Yes");
					break;
				} check == true check true {
					System.out.println("Yes");
					break;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" break; if(check == false) {
			System.out.println("No");
		} check == false check false {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args public static boolean search(String s , String p) {
		for(int i = 0 ; i < p.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(i,i+1);
			if(!fs.equals(fp)){
				return false;
			}
		}

		return true;
	} search {
		for(int i = 0 ; i < p.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(i,i+1);
			if(!fs.equals(fp)){
				return false;
			}
		}

		return true;
	} for(int i = 0 ; i < p.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(i,i+1);
			if(!fs.equals(fp)){
				return false;
			}
		} int i = 0 ; int i = 0 ; i 0 i < p.length() i p.length() p.length p i++ i++ i {
			String fs = s.substring(i,i+1);
			String fp = p.substring(i,i+1);
			if(!fs.equals(fp)){
				return false;
			}
		} {
			String fs = s.substring(i,i+1);
			String fp = p.substring(i,i+1);
			if(!fs.equals(fp)){
				return false;
			}
		} String fs = s.substring(i,i+1); fs s.substring(i,i+1) s.substring s i i+1 i 1 String fp = p.substring(i,i+1); fp p.substring(i,i+1) p.substring p i i+1 i 1 if(!fs.equals(fp)){
				return false;
			} !fs.equals(fp) fs.equals(fp) fs.equals fs fp {
				return false;
			} return false; false return true; true String s s String p p public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		boolean check = false;
		for(int i = 0 ; i < s.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(0,1);
			if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			}
		}
		if(check == false) {
			System.out.println("No");
		}
	}
	public static boolean search(String s , String p) {
		for(int i = 0 ; i < p.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(i,i+1);
			if(!fs.equals(fp)){
				return false;
			}
		}

		return true;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		boolean check = false;
		for(int i = 0 ; i < s.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(0,1);
			if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			}
		}
		if(check == false) {
			System.out.println("No");
		}
	}
	public static boolean search(String s , String p) {
		for(int i = 0 ; i < p.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(i,i+1);
			if(!fs.equals(fp)){
				return false;
			}
		}

		return true;
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		boolean check = false;
		for(int i = 0 ; i < s.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(0,1);
			if(fs.equals(fp)){
				String sort = s.substring(i,s.length());
				String c = s.substring(0,i);
				check = search(sort+c,p);
				if(check == true) {
					System.out.println("Yes");
					break;
				}
			}
		}
		if(check == false) {
			System.out.println("No");
		}
	}
	public static boolean search(String s , String p) {
		for(int i = 0 ; i < p.length() ; i++) {
			String fs = s.substring(i,i+1);
			String fp = p.substring(i,i+1);
			if(!fs.equals(fp)){
				return false;
			}
		}

		return true;
	}
}

