import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			cs[i] = s.charAt(i);
		}
		boolean f = false;
		for (int i = 0; i < s.length(); i++) {
			String u = new String(cs);
			if (t.equals(u)) {
				f = true;
			}
			char a = cs[s.length()-1];
          	char[] cu = new char[s.length()];
			for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			}
			cu[0] = a;
			cs = cu;
		}
		if (f) {
			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 scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			cs[i] = s.charAt(i);
		}
		boolean f = false;
		for (int i = 0; i < s.length(); i++) {
			String u = new String(cs);
			if (t.equals(u)) {
				f = true;
			}
			char a = cs[s.length()-1];
          	char[] cu = new char[s.length()];
			for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			}
			cu[0] = a;
			cs = cu;
		}
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			cs[i] = s.charAt(i);
		}
		boolean f = false;
		for (int i = 0; i < s.length(); i++) {
			String u = new String(cs);
			if (t.equals(u)) {
				f = true;
			}
			char a = cs[s.length()-1];
          	char[] cu = new char[s.length()];
			for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			}
			cu[0] = a;
			cs = cu;
		}
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			cs[i] = s.charAt(i);
		}
		boolean f = false;
		for (int i = 0; i < s.length(); i++) {
			String u = new String(cs);
			if (t.equals(u)) {
				f = true;
			}
			char a = cs[s.length()-1];
          	char[] cu = new char[s.length()];
			for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			}
			cu[0] = a;
			cs = cu;
		}
		if (f) {
			System.out.println("Yes");
		} else {
			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 t = scan.next(); t scan.next() scan.next scan char[] cs = new char[s.length()]; cs new char[s.length()] s.length() s.length s for (int i = 0; i < s.length(); i++) {
			cs[i] = s.charAt(i);
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			cs[i] = s.charAt(i);
		} {
			cs[i] = s.charAt(i);
		} cs[i] = s.charAt(i) cs[i] cs i s.charAt(i) s.charAt s i boolean f = false; f false for (int i = 0; i < s.length(); i++) {
			String u = new String(cs);
			if (t.equals(u)) {
				f = true;
			}
			char a = cs[s.length()-1];
          	char[] cu = new char[s.length()];
			for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			}
			cu[0] = a;
			cs = cu;
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			String u = new String(cs);
			if (t.equals(u)) {
				f = true;
			}
			char a = cs[s.length()-1];
          	char[] cu = new char[s.length()];
			for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			}
			cu[0] = a;
			cs = cu;
		} {
			String u = new String(cs);
			if (t.equals(u)) {
				f = true;
			}
			char a = cs[s.length()-1];
          	char[] cu = new char[s.length()];
			for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			}
			cu[0] = a;
			cs = cu;
		} String u = new String(cs); u new String(cs) if (t.equals(u)) {
				f = true;
			} t.equals(u) t.equals t u {
				f = true;
			} f = true f true char a = cs[s.length()-1]; a cs[s.length()-1] cs s.length()-1 s.length() s.length s 1 char[] cu = new char[s.length()]; cu new char[s.length()] s.length() s.length s for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			} int j = 0; int j = 0; j 0 j < s.length()-1 j s.length()-1 s.length() s.length s 1 j++ j++ j {
				cu[j+1] = cs[j]; 
			} {
				cu[j+1] = cs[j]; 
			} cu[j+1] = cs[j] cu[j+1] cu j+1 j 1 cs[j] cs j cu[0] = a cu[0] cu 0 a cs = cu cs cu if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} f {
			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 scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			cs[i] = s.charAt(i);
		}
		boolean f = false;
		for (int i = 0; i < s.length(); i++) {
			String u = new String(cs);
			if (t.equals(u)) {
				f = true;
			}
			char a = cs[s.length()-1];
          	char[] cu = new char[s.length()];
			for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			}
			cu[0] = a;
			cs = cu;
		}
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		char[] cs = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			cs[i] = s.charAt(i);
		}
		boolean f = false;
		for (int i = 0; i < s.length(); i++) {
			String u = new String(cs);
			if (t.equals(u)) {
				f = true;
			}
			char a = cs[s.length()-1];
          	char[] cu = new char[s.length()];
			for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			}
			cu[0] = a;
			cs = cu;
		}
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} 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 t = scan.next();
		char[] cs = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			cs[i] = s.charAt(i);
		}
		boolean f = false;
		for (int i = 0; i < s.length(); i++) {
			String u = new String(cs);
			if (t.equals(u)) {
				f = true;
			}
			char a = cs[s.length()-1];
          	char[] cu = new char[s.length()];
			for (int j = 0; j < s.length()-1; j++) {
				cu[j+1] = cs[j]; 
			}
			cu[0] = a;
			cs = cu;
		}
		if (f) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}
