import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);
		String s = sc1.next();
		String t = sc1.next();
		boolean flag = false;

		for (int i = 0 ; i < s.length() ; i++ ) {
			String str;
			str = s.substring(1,s.length()) + s.substring(0, 1);
			//System.out.println(str);
			//System.out.println(s);
			if ( str.equals(t)) {
				flag = true;
				break;
			}
			s = str;
		}

		if(flag) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

		sc1.close();
	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);
		String s = sc1.next();
		String t = sc1.next();
		boolean flag = false;

		for (int i = 0 ; i < s.length() ; i++ ) {
			String str;
			str = s.substring(1,s.length()) + s.substring(0, 1);
			//System.out.println(str);
			//System.out.println(s);
			if ( str.equals(t)) {
				flag = true;
				break;
			}
			s = str;
		}

		if(flag) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

		sc1.close();
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);
		String s = sc1.next();
		String t = sc1.next();
		boolean flag = false;

		for (int i = 0 ; i < s.length() ; i++ ) {
			String str;
			str = s.substring(1,s.length()) + s.substring(0, 1);
			//System.out.println(str);
			//System.out.println(s);
			if ( str.equals(t)) {
				flag = true;
				break;
			}
			s = str;
		}

		if(flag) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

		sc1.close();
	} main {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);
		String s = sc1.next();
		String t = sc1.next();
		boolean flag = false;

		for (int i = 0 ; i < s.length() ; i++ ) {
			String str;
			str = s.substring(1,s.length()) + s.substring(0, 1);
			//System.out.println(str);
			//System.out.println(s);
			if ( str.equals(t)) {
				flag = true;
				break;
			}
			s = str;
		}

		if(flag) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

		sc1.close();
	} Scanner sc1 = new Scanner(System.in); sc1 new Scanner(System.in) String s = sc1.next(); s sc1.next() sc1.next sc1 String t = sc1.next(); t sc1.next() sc1.next sc1 boolean flag = false; flag false for (int i = 0 ; i < s.length() ; i++ ) {
			String str;
			str = s.substring(1,s.length()) + s.substring(0, 1);
			//System.out.println(str);
			//System.out.println(s);
			if ( str.equals(t)) {
				flag = true;
				break;
			}
			s = str;
		} int i = 0 ; int i = 0 ; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			String str;
			str = s.substring(1,s.length()) + s.substring(0, 1);
			//System.out.println(str);
			//System.out.println(s);
			if ( str.equals(t)) {
				flag = true;
				break;
			}
			s = str;
		} {
			String str;
			str = s.substring(1,s.length()) + s.substring(0, 1);
			//System.out.println(str);
			//System.out.println(s);
			if ( str.equals(t)) {
				flag = true;
				break;
			}
			s = str;
		} String str; str str = s.substring(1,s.length()) + s.substring(0, 1) str s.substring(1,s.length()) + s.substring(0, 1) s.substring(1,s.length()) s.substring s 1 s.length() s.length s s.substring(0, 1) s.substring s 0 1 if ( str.equals(t)) {
				flag = true;
				break;
			} str.equals(t) str.equals str t {
				flag = true;
				break;
			} flag = true flag true break; s = str s str 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" sc1.close() sc1.close sc1 String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);
		String s = sc1.next();
		String t = sc1.next();
		boolean flag = false;

		for (int i = 0 ; i < s.length() ; i++ ) {
			String str;
			str = s.substring(1,s.length()) + s.substring(0, 1);
			//System.out.println(str);
			//System.out.println(s);
			if ( str.equals(t)) {
				flag = true;
				break;
			}
			s = str;
		}

		if(flag) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

		sc1.close();
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);
		String s = sc1.next();
		String t = sc1.next();
		boolean flag = false;

		for (int i = 0 ; i < s.length() ; i++ ) {
			String str;
			str = s.substring(1,s.length()) + s.substring(0, 1);
			//System.out.println(str);
			//System.out.println(s);
			if ( str.equals(t)) {
				flag = true;
				break;
			}
			s = str;
		}

		if(flag) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

		sc1.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);
		String s = sc1.next();
		String t = sc1.next();
		boolean flag = false;

		for (int i = 0 ; i < s.length() ; i++ ) {
			String str;
			str = s.substring(1,s.length()) + s.substring(0, 1);
			//System.out.println(str);
			//System.out.println(s);
			if ( str.equals(t)) {
				flag = true;
				break;
			}
			s = str;
		}

		if(flag) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

		sc1.close();
	}

}