import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuffer str1=new StringBuffer(sc.nextLine());
		StringBuffer str2=new StringBuffer(sc.nextLine());		
		int len=str1.length();
		if(len!=str2.length()){
			System.out.println("No");
			return;
		}
		while(len-->0){
			StringBuffer sb=new StringBuffer();
			char c=str1.charAt(0);
			sb.append(str1.substring(1));
			sb.append(c);
			str1=sb;
			//System.out.println(str1);
			if(str1.toString().equals(str2.toString())){
				System.out.println("Yes");
				return;
			}
		}
		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);
		StringBuffer str1=new StringBuffer(sc.nextLine());
		StringBuffer str2=new StringBuffer(sc.nextLine());		
		int len=str1.length();
		if(len!=str2.length()){
			System.out.println("No");
			return;
		}
		while(len-->0){
			StringBuffer sb=new StringBuffer();
			char c=str1.charAt(0);
			sb.append(str1.substring(1));
			sb.append(c);
			str1=sb;
			//System.out.println(str1);
			if(str1.toString().equals(str2.toString())){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuffer str1=new StringBuffer(sc.nextLine());
		StringBuffer str2=new StringBuffer(sc.nextLine());		
		int len=str1.length();
		if(len!=str2.length()){
			System.out.println("No");
			return;
		}
		while(len-->0){
			StringBuffer sb=new StringBuffer();
			char c=str1.charAt(0);
			sb.append(str1.substring(1));
			sb.append(c);
			str1=sb;
			//System.out.println(str1);
			if(str1.toString().equals(str2.toString())){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} main {
		Scanner sc=new Scanner(System.in);
		StringBuffer str1=new StringBuffer(sc.nextLine());
		StringBuffer str2=new StringBuffer(sc.nextLine());		
		int len=str1.length();
		if(len!=str2.length()){
			System.out.println("No");
			return;
		}
		while(len-->0){
			StringBuffer sb=new StringBuffer();
			char c=str1.charAt(0);
			sb.append(str1.substring(1));
			sb.append(c);
			str1=sb;
			//System.out.println(str1);
			if(str1.toString().equals(str2.toString())){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) StringBuffer str1=new StringBuffer(sc.nextLine()); str1 new StringBuffer(sc.nextLine()) StringBuffer str2=new StringBuffer(sc.nextLine()); str2 new StringBuffer(sc.nextLine()) int len=str1.length(); len str1.length() str1.length str1 if(len!=str2.length()){
			System.out.println("No");
			return;
		} len!=str2.length() len str2.length() str2.length str2 {
			System.out.println("No");
			return;
		} System.out.println("No") System.out.println System.out System System.out "No" return; while(len-->0){
			StringBuffer sb=new StringBuffer();
			char c=str1.charAt(0);
			sb.append(str1.substring(1));
			sb.append(c);
			str1=sb;
			//System.out.println(str1);
			if(str1.toString().equals(str2.toString())){
				System.out.println("Yes");
				return;
			}
		} len-->0 len-- len 0 {
			StringBuffer sb=new StringBuffer();
			char c=str1.charAt(0);
			sb.append(str1.substring(1));
			sb.append(c);
			str1=sb;
			//System.out.println(str1);
			if(str1.toString().equals(str2.toString())){
				System.out.println("Yes");
				return;
			}
		} StringBuffer sb=new StringBuffer(); sb new StringBuffer() char c=str1.charAt(0); c str1.charAt(0) str1.charAt str1 0 sb.append(str1.substring(1)) sb.append sb str1.substring(1) str1.substring str1 1 sb.append(c) sb.append sb c str1=sb str1 sb if(str1.toString().equals(str2.toString())){
				System.out.println("Yes");
				return;
			} str1.toString().equals(str2.toString()) str1.toString().equals str1.toString() str1.toString str1 str2.toString() str2.toString str2 {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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);
		StringBuffer str1=new StringBuffer(sc.nextLine());
		StringBuffer str2=new StringBuffer(sc.nextLine());		
		int len=str1.length();
		if(len!=str2.length()){
			System.out.println("No");
			return;
		}
		while(len-->0){
			StringBuffer sb=new StringBuffer();
			char c=str1.charAt(0);
			sb.append(str1.substring(1));
			sb.append(c);
			str1=sb;
			//System.out.println(str1);
			if(str1.toString().equals(str2.toString())){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuffer str1=new StringBuffer(sc.nextLine());
		StringBuffer str2=new StringBuffer(sc.nextLine());		
		int len=str1.length();
		if(len!=str2.length()){
			System.out.println("No");
			return;
		}
		while(len-->0){
			StringBuffer sb=new StringBuffer();
			char c=str1.charAt(0);
			sb.append(str1.substring(1));
			sb.append(c);
			str1=sb;
			//System.out.println(str1);
			if(str1.toString().equals(str2.toString())){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuffer str1=new StringBuffer(sc.nextLine());
		StringBuffer str2=new StringBuffer(sc.nextLine());		
		int len=str1.length();
		if(len!=str2.length()){
			System.out.println("No");
			return;
		}
		while(len-->0){
			StringBuffer sb=new StringBuffer();
			char c=str1.charAt(0);
			sb.append(str1.substring(1));
			sb.append(c);
			str1=sb;
			//System.out.println(str1);
			if(str1.toString().equals(str2.toString())){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}
