import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		String tmp = s;
		boolean match = false;

		for (int i = 0; i<s.length(); i++){
			tmp = Rotate(tmp);
			if (tmp.equals(t)){
				match = true;
				break;
			}
		}
		if (match){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static String Rotate(String source){
		String ret = source.substring(source.length() - 1) + source.substring(0, source.length()-1);
		return ret;
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		String tmp = s;
		boolean match = false;

		for (int i = 0; i<s.length(); i++){
			tmp = Rotate(tmp);
			if (tmp.equals(t)){
				match = true;
				break;
			}
		}
		if (match){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static String Rotate(String source){
		String ret = source.substring(source.length() - 1) + source.substring(0, source.length()-1);
		return ret;
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		String tmp = s;
		boolean match = false;

		for (int i = 0; i<s.length(); i++){
			tmp = Rotate(tmp);
			if (tmp.equals(t)){
				match = true;
				break;
			}
		}
		if (match){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		String tmp = s;
		boolean match = false;

		for (int i = 0; i<s.length(); i++){
			tmp = Rotate(tmp);
			if (tmp.equals(t)){
				match = true;
				break;
			}
		}
		if (match){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc String tmp = s; tmp s boolean match = false; match false for (int i = 0; i<s.length(); i++){
			tmp = Rotate(tmp);
			if (tmp.equals(t)){
				match = true;
				break;
			}
		} int i = 0; int i = 0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			tmp = Rotate(tmp);
			if (tmp.equals(t)){
				match = true;
				break;
			}
		} {
			tmp = Rotate(tmp);
			if (tmp.equals(t)){
				match = true;
				break;
			}
		} tmp = Rotate(tmp) tmp Rotate(tmp) Rotate tmp if (tmp.equals(t)){
				match = true;
				break;
			} tmp.equals(t) tmp.equals tmp t {
				match = true;
				break;
			} match = true match true break; if (match){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} match {
			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 static String Rotate(String source){
		String ret = source.substring(source.length() - 1) + source.substring(0, source.length()-1);
		return ret;
	} Rotate {
		String ret = source.substring(source.length() - 1) + source.substring(0, source.length()-1);
		return ret;
	} String ret = source.substring(source.length() - 1) + source.substring(0, source.length()-1); ret source.substring(source.length() - 1) + source.substring(0, source.length()-1) source.substring(source.length() - 1) source.substring source source.length() - 1 source.length() source.length source 1 source.substring(0, source.length()-1) source.substring source 0 source.length()-1 source.length() source.length source 1 return ret; ret String source source public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		String tmp = s;
		boolean match = false;

		for (int i = 0; i<s.length(); i++){
			tmp = Rotate(tmp);
			if (tmp.equals(t)){
				match = true;
				break;
			}
		}
		if (match){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static String Rotate(String source){
		String ret = source.substring(source.length() - 1) + source.substring(0, source.length()-1);
		return ret;
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		String tmp = s;
		boolean match = false;

		for (int i = 0; i<s.length(); i++){
			tmp = Rotate(tmp);
			if (tmp.equals(t)){
				match = true;
				break;
			}
		}
		if (match){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static String Rotate(String source){
		String ret = source.substring(source.length() - 1) + source.substring(0, source.length()-1);
		return ret;
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		String tmp = s;
		boolean match = false;

		for (int i = 0; i<s.length(); i++){
			tmp = Rotate(tmp);
			if (tmp.equals(t)){
				match = true;
				break;
			}
		}
		if (match){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static String Rotate(String source){
		String ret = source.substring(source.length() - 1) + source.substring(0, source.length()-1);
		return ret;
	}
}