import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		String t = stdIn.next();
		
		boolean flag = false;
		String a = "";
		
		for(int i = 0; i < s.length(); i++) {
			a = s.substring(i,s.length())+s.substring(0,i);
			if(a.equals(t)){
				flag = true;
			}
		}
		
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		String t = stdIn.next();
		
		boolean flag = false;
		String a = "";
		
		for(int i = 0; i < s.length(); i++) {
			a = s.substring(i,s.length())+s.substring(0,i);
			if(a.equals(t)){
				flag = true;
			}
		}
		
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		String t = stdIn.next();
		
		boolean flag = false;
		String a = "";
		
		for(int i = 0; i < s.length(); i++) {
			a = s.substring(i,s.length())+s.substring(0,i);
			if(a.equals(t)){
				flag = true;
			}
		}
		
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
	} main {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		String t = stdIn.next();
		
		boolean flag = false;
		String a = "";
		
		for(int i = 0; i < s.length(); i++) {
			a = s.substring(i,s.length())+s.substring(0,i);
			if(a.equals(t)){
				flag = true;
			}
		}
		
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String s = stdIn.next(); s stdIn.next() stdIn.next stdIn String t = stdIn.next(); t stdIn.next() stdIn.next stdIn boolean flag = false; flag false String a = ""; a "" for(int i = 0; i < s.length(); i++) {
			a = s.substring(i,s.length())+s.substring(0,i);
			if(a.equals(t)){
				flag = true;
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			a = s.substring(i,s.length())+s.substring(0,i);
			if(a.equals(t)){
				flag = true;
			}
		} {
			a = s.substring(i,s.length())+s.substring(0,i);
			if(a.equals(t)){
				flag = true;
			}
		} a = s.substring(i,s.length())+s.substring(0,i) a s.substring(i,s.length())+s.substring(0,i) s.substring(i,s.length()) s.substring s i s.length() s.length s s.substring(0,i) s.substring s 0 i if(a.equals(t)){
				flag = true;
			} a.equals(t) a.equals a t {
				flag = true;
			} flag = true flag true if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} flag {
			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) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		String t = stdIn.next();
		
		boolean flag = false;
		String a = "";
		
		for(int i = 0; i < s.length(); i++) {
			a = s.substring(i,s.length())+s.substring(0,i);
			if(a.equals(t)){
				flag = true;
			}
		}
		
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		String t = stdIn.next();
		
		boolean flag = false;
		String a = "";
		
		for(int i = 0; i < s.length(); i++) {
			a = s.substring(i,s.length())+s.substring(0,i);
			if(a.equals(t)){
				flag = true;
			}
		}
		
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
	}

} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		String t = stdIn.next();
		
		boolean flag = false;
		String a = "";
		
		for(int i = 0; i < s.length(); i++) {
			a = s.substring(i,s.length())+s.substring(0,i);
			if(a.equals(t)){
				flag = true;
			}
		}
		
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
	}

}
