	import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);

			String str1 = sc.next();
			String str2 = sc.next();

			boolean flg = false;
			char [] array = new char[str1.length()];
			char tmp;

			for(int i =0;i<str1.length();i++) {
				if(str1.equals(str2)) {
					flg = true;
					break;
				}

				for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				}

				tmp = array[array.length-1];

				for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				}

				array[0] = tmp;

				StringBuilder sb = new StringBuilder();
				for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				}
				str1 = new String(sb);

			}

			if(flg == true) {
				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 sc = new Scanner(System.in);

			String str1 = sc.next();
			String str2 = sc.next();

			boolean flg = false;
			char [] array = new char[str1.length()];
			char tmp;

			for(int i =0;i<str1.length();i++) {
				if(str1.equals(str2)) {
					flg = true;
					break;
				}

				for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				}

				tmp = array[array.length-1];

				for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				}

				array[0] = tmp;

				StringBuilder sb = new StringBuilder();
				for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				}
				str1 = new String(sb);

			}

			if(flg == true) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}

		}

	} Main public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);

			String str1 = sc.next();
			String str2 = sc.next();

			boolean flg = false;
			char [] array = new char[str1.length()];
			char tmp;

			for(int i =0;i<str1.length();i++) {
				if(str1.equals(str2)) {
					flg = true;
					break;
				}

				for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				}

				tmp = array[array.length-1];

				for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				}

				array[0] = tmp;

				StringBuilder sb = new StringBuilder();
				for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				}
				str1 = new String(sb);

			}

			if(flg == true) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}

		} main {
			Scanner sc = new Scanner(System.in);

			String str1 = sc.next();
			String str2 = sc.next();

			boolean flg = false;
			char [] array = new char[str1.length()];
			char tmp;

			for(int i =0;i<str1.length();i++) {
				if(str1.equals(str2)) {
					flg = true;
					break;
				}

				for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				}

				tmp = array[array.length-1];

				for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				}

				array[0] = tmp;

				StringBuilder sb = new StringBuilder();
				for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				}
				str1 = new String(sb);

			}

			if(flg == true) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}

		} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str1 = sc.next(); str1 sc.next() sc.next sc String str2 = sc.next(); str2 sc.next() sc.next sc boolean flg = false; flg false char [] array = new char[str1.length()]; array new char[str1.length()] str1.length() str1.length str1 char tmp; tmp for(int i =0;i<str1.length();i++) {
				if(str1.equals(str2)) {
					flg = true;
					break;
				}

				for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				}

				tmp = array[array.length-1];

				for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				}

				array[0] = tmp;

				StringBuilder sb = new StringBuilder();
				for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				}
				str1 = new String(sb);

			} int i =0; int i =0; i 0 i<str1.length() i str1.length() str1.length str1 i++ i++ i {
				if(str1.equals(str2)) {
					flg = true;
					break;
				}

				for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				}

				tmp = array[array.length-1];

				for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				}

				array[0] = tmp;

				StringBuilder sb = new StringBuilder();
				for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				}
				str1 = new String(sb);

			} {
				if(str1.equals(str2)) {
					flg = true;
					break;
				}

				for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				}

				tmp = array[array.length-1];

				for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				}

				array[0] = tmp;

				StringBuilder sb = new StringBuilder();
				for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				}
				str1 = new String(sb);

			} if(str1.equals(str2)) {
					flg = true;
					break;
				} str1.equals(str2) str1.equals str1 str2 {
					flg = true;
					break;
				} flg = true flg true break; for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				} int j=0; int j=0; j 0 j<str1.length() j str1.length() str1.length str1 j++ j++ j {
					array[j]=str1.charAt(j);
				} {
					array[j]=str1.charAt(j);
				} array[j]=str1.charAt(j) array[j] array j str1.charAt(j) str1.charAt str1 j tmp = array[array.length-1] tmp array[array.length-1] array array.length-1 array.length array array.length 1 for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				} int j=str1.length()-1; int j=str1.length()-1; j str1.length()-1 str1.length() str1.length str1 1 j>0 j 0 j-- j-- j {
					array[j]=str1.charAt(j-1);
				} {
					array[j]=str1.charAt(j-1);
				} array[j]=str1.charAt(j-1) array[j] array j str1.charAt(j-1) str1.charAt str1 j-1 j 1 array[0] = tmp array[0] array 0 tmp StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				} int j=0; int j=0; j 0 j<array.length j array.length array array.length j++ j++ j {
					sb.append(array[j]);
				} {
					sb.append(array[j]);
				} sb.append(array[j]) sb.append sb array[j] array j str1 = new String(sb) str1 new String(sb) if(flg == true) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			} flg == true flg true {
				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 sc = new Scanner(System.in);

			String str1 = sc.next();
			String str2 = sc.next();

			boolean flg = false;
			char [] array = new char[str1.length()];
			char tmp;

			for(int i =0;i<str1.length();i++) {
				if(str1.equals(str2)) {
					flg = true;
					break;
				}

				for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				}

				tmp = array[array.length-1];

				for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				}

				array[0] = tmp;

				StringBuilder sb = new StringBuilder();
				for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				}
				str1 = new String(sb);

			}

			if(flg == true) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}

		}

	} public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);

			String str1 = sc.next();
			String str2 = sc.next();

			boolean flg = false;
			char [] array = new char[str1.length()];
			char tmp;

			for(int i =0;i<str1.length();i++) {
				if(str1.equals(str2)) {
					flg = true;
					break;
				}

				for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				}

				tmp = array[array.length-1];

				for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				}

				array[0] = tmp;

				StringBuilder sb = new StringBuilder();
				for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				}
				str1 = new String(sb);

			}

			if(flg == true) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}

		}

	} Main
	import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);

			String str1 = sc.next();
			String str2 = sc.next();

			boolean flg = false;
			char [] array = new char[str1.length()];
			char tmp;

			for(int i =0;i<str1.length();i++) {
				if(str1.equals(str2)) {
					flg = true;
					break;
				}

				for(int j=0;j<str1.length();j++) {
					array[j]=str1.charAt(j);
				}

				tmp = array[array.length-1];

				for(int j=str1.length()-1; j>0;j--) {
					array[j]=str1.charAt(j-1);
				}

				array[0] = tmp;

				StringBuilder sb = new StringBuilder();
				for(int j=0; j<array.length;j++) {
					sb.append(array[j]);
				}
				str1 = new String(sb);

			}

			if(flg == true) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}

		}

	}


