import 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[] Sdata = new String[S.length()];
		Sdata = S.split("");
		String[] Tdata = new String[T.length()];
		Tdata = T.split("");
		int flg = 0;
		for(int i = 0;i < S.length();i ++) {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		}
		if(flg == 0)System.out.println("No");
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		String[] Sdata = new String[S.length()];
		Sdata = S.split("");
		String[] Tdata = new String[T.length()];
		Tdata = T.split("");
		int flg = 0;
		for(int i = 0;i < S.length();i ++) {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		}
		if(flg == 0)System.out.println("No");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		String[] Sdata = new String[S.length()];
		Sdata = S.split("");
		String[] Tdata = new String[T.length()];
		Tdata = T.split("");
		int flg = 0;
		for(int i = 0;i < S.length();i ++) {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		}
		if(flg == 0)System.out.println("No");
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		String[] Sdata = new String[S.length()];
		Sdata = S.split("");
		String[] Tdata = new String[T.length()];
		Tdata = T.split("");
		int flg = 0;
		for(int i = 0;i < S.length();i ++) {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		}
		if(flg == 0)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[] Sdata = new String[S.length()]; Sdata new String[S.length()] S.length() S.length S Sdata = S.split("") Sdata S.split("") S.split S "" String[] Tdata = new String[T.length()]; Tdata new String[T.length()] T.length() T.length T Tdata = T.split("") Tdata T.split("") T.split T "" int flg = 0; flg 0 for(int i = 0;i < S.length();i ++) {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i ++ i ++ i {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		} {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		} int ccnt = 0; ccnt 0 for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			} int k = 0; int k = 0; k 0 k < S.length() k S.length() S.length S k ++ k ++ k {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			} {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			} if(Sdata[k].equals(Tdata[k])) ccnt++; Sdata[k].equals(Tdata[k]) Sdata[k].equals Sdata[k] Sdata k Tdata[k] Tdata k ccnt++ ccnt if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;} ccnt == S.length() ccnt S.length() S.length S {System.out.println("Yes"); flg = 1;break;} System.out.println("Yes") System.out.println System.out System System.out "Yes" flg = 1 flg 1 break; char[] clast = Sdata[S.length() - 1].toCharArray(); clast Sdata[S.length() - 1].toCharArray() Sdata[S.length() - 1].toCharArray Sdata[S.length() - 1] Sdata S.length() - 1 S.length() S.length S 1 for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			} int k = S.length() - 1; int k = S.length() - 1; k S.length() - 1 S.length() S.length S 1 k > 0 k 0 k -- k -- k {
				Sdata[k] = Sdata[k-1];
			} {
				Sdata[k] = Sdata[k-1];
			} Sdata[k] = Sdata[k-1] Sdata[k] Sdata k Sdata[k-1] Sdata k-1 k 1 Sdata[0] = String.valueOf(clast[0]) Sdata[0] Sdata 0 String.valueOf(clast[0]) String.valueOf String clast[0] clast 0 if(flg == 0)System.out.println("No"); flg == 0 flg 0 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 S = sc.next();
		String T = sc.next();
		String[] Sdata = new String[S.length()];
		Sdata = S.split("");
		String[] Tdata = new String[T.length()];
		Tdata = T.split("");
		int flg = 0;
		for(int i = 0;i < S.length();i ++) {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		}
		if(flg == 0)System.out.println("No");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		String[] Sdata = new String[S.length()];
		Sdata = S.split("");
		String[] Tdata = new String[T.length()];
		Tdata = T.split("");
		int flg = 0;
		for(int i = 0;i < S.length();i ++) {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		}
		if(flg == 0)System.out.println("No");
	}
} Main
import 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[] Sdata = new String[S.length()];
		Sdata = S.split("");
		String[] Tdata = new String[T.length()];
		Tdata = T.split("");
		int flg = 0;
		for(int i = 0;i < S.length();i ++) {
			int ccnt = 0;
			/*for(int k = 0;k < S.length();k ++) {
				System.out.print(Sdata[k]);
			}
			System.out.println();
			for(int k = 0;k < S.length();k ++) {
				System.out.print(Tdata[k]);
			}
			System.out.println();*/
			for(int k = 0;k < S.length();k ++) {
				if(Sdata[k].equals(Tdata[k])) ccnt++;
			}
			//System.out.println(ccnt);
			if(ccnt == S.length()) {System.out.println("Yes"); flg = 1;break;}
			char[] clast = Sdata[S.length() - 1].toCharArray();
			for(int k = S.length() - 1;k > 0;k --) {
				Sdata[k] = Sdata[k-1];
			}
			Sdata[0] = String.valueOf(clast[0]);
		}
		if(flg == 0)System.out.println("No");
	}
}
