import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String stringA = sc.next();
		String stringB = sc.next();
		sc.close();
		int lengthA = stringA.length();	
		boolean match = false;
		char[] chars = new char[lengthA];
		for(int a = 0; a < lengthA; a++){
			chars[a] = stringA.charAt(a);
		}
		for(int move = 0 ; move < lengthA ; move++){
			char[] tmpStringAc = new char[lengthA];
			int inputPoint = 0;
			for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			}
			String tmpStringA = new String(tmpStringAc);
			if(tmpStringA.equals(stringB)){
				match = true;
				break;
			}
		}
		System.out.println(match?"Yes":"No");
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String stringA = sc.next();
		String stringB = sc.next();
		sc.close();
		int lengthA = stringA.length();	
		boolean match = false;
		char[] chars = new char[lengthA];
		for(int a = 0; a < lengthA; a++){
			chars[a] = stringA.charAt(a);
		}
		for(int move = 0 ; move < lengthA ; move++){
			char[] tmpStringAc = new char[lengthA];
			int inputPoint = 0;
			for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			}
			String tmpStringA = new String(tmpStringAc);
			if(tmpStringA.equals(stringB)){
				match = true;
				break;
			}
		}
		System.out.println(match?"Yes":"No");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String stringA = sc.next();
		String stringB = sc.next();
		sc.close();
		int lengthA = stringA.length();	
		boolean match = false;
		char[] chars = new char[lengthA];
		for(int a = 0; a < lengthA; a++){
			chars[a] = stringA.charAt(a);
		}
		for(int move = 0 ; move < lengthA ; move++){
			char[] tmpStringAc = new char[lengthA];
			int inputPoint = 0;
			for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			}
			String tmpStringA = new String(tmpStringAc);
			if(tmpStringA.equals(stringB)){
				match = true;
				break;
			}
		}
		System.out.println(match?"Yes":"No");
	} main {
		Scanner sc = new Scanner(System.in);
		String stringA = sc.next();
		String stringB = sc.next();
		sc.close();
		int lengthA = stringA.length();	
		boolean match = false;
		char[] chars = new char[lengthA];
		for(int a = 0; a < lengthA; a++){
			chars[a] = stringA.charAt(a);
		}
		for(int move = 0 ; move < lengthA ; move++){
			char[] tmpStringAc = new char[lengthA];
			int inputPoint = 0;
			for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			}
			String tmpStringA = new String(tmpStringAc);
			if(tmpStringA.equals(stringB)){
				match = true;
				break;
			}
		}
		System.out.println(match?"Yes":"No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String stringA = sc.next(); stringA sc.next() sc.next sc String stringB = sc.next(); stringB sc.next() sc.next sc sc.close() sc.close sc int lengthA = stringA.length(); lengthA stringA.length() stringA.length stringA boolean match = false; match false char[] chars = new char[lengthA]; chars new char[lengthA] lengthA for(int a = 0; a < lengthA; a++){
			chars[a] = stringA.charAt(a);
		} int a = 0; int a = 0; a 0 a < lengthA a lengthA a++ a++ a {
			chars[a] = stringA.charAt(a);
		} {
			chars[a] = stringA.charAt(a);
		} chars[a] = stringA.charAt(a) chars[a] chars a stringA.charAt(a) stringA.charAt stringA a for(int move = 0 ; move < lengthA ; move++){
			char[] tmpStringAc = new char[lengthA];
			int inputPoint = 0;
			for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			}
			String tmpStringA = new String(tmpStringAc);
			if(tmpStringA.equals(stringB)){
				match = true;
				break;
			}
		} int move = 0 ; int move = 0 ; move 0 move < lengthA move lengthA move++ move++ move {
			char[] tmpStringAc = new char[lengthA];
			int inputPoint = 0;
			for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			}
			String tmpStringA = new String(tmpStringAc);
			if(tmpStringA.equals(stringB)){
				match = true;
				break;
			}
		} {
			char[] tmpStringAc = new char[lengthA];
			int inputPoint = 0;
			for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			}
			String tmpStringA = new String(tmpStringAc);
			if(tmpStringA.equals(stringB)){
				match = true;
				break;
			}
		} char[] tmpStringAc = new char[lengthA]; tmpStringAc new char[lengthA] lengthA int inputPoint = 0; inputPoint 0 for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			} int inputChar = 0 ; int inputChar = 0 ; inputChar 0 inputChar < lengthA inputChar lengthA inputChar++ inputChar++ inputChar {
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			} {
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			} inputPoint = inputChar + move inputPoint inputChar + move inputChar move if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				} inputPoint>=lengthA inputPoint lengthA {
					inputPoint = inputPoint - lengthA;
				} inputPoint = inputPoint - lengthA inputPoint inputPoint - lengthA inputPoint lengthA tmpStringAc[inputPoint] = chars[inputChar] tmpStringAc[inputPoint] tmpStringAc inputPoint chars[inputChar] chars inputChar String tmpStringA = new String(tmpStringAc); tmpStringA new String(tmpStringAc) if(tmpStringA.equals(stringB)){
				match = true;
				break;
			} tmpStringA.equals(stringB) tmpStringA.equals tmpStringA stringB {
				match = true;
				break;
			} match = true match true break; System.out.println(match?"Yes":"No") System.out.println System.out System System.out match?"Yes":"No" match "Yes" "No" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String stringA = sc.next();
		String stringB = sc.next();
		sc.close();
		int lengthA = stringA.length();	
		boolean match = false;
		char[] chars = new char[lengthA];
		for(int a = 0; a < lengthA; a++){
			chars[a] = stringA.charAt(a);
		}
		for(int move = 0 ; move < lengthA ; move++){
			char[] tmpStringAc = new char[lengthA];
			int inputPoint = 0;
			for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			}
			String tmpStringA = new String(tmpStringAc);
			if(tmpStringA.equals(stringB)){
				match = true;
				break;
			}
		}
		System.out.println(match?"Yes":"No");
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String stringA = sc.next();
		String stringB = sc.next();
		sc.close();
		int lengthA = stringA.length();	
		boolean match = false;
		char[] chars = new char[lengthA];
		for(int a = 0; a < lengthA; a++){
			chars[a] = stringA.charAt(a);
		}
		for(int move = 0 ; move < lengthA ; move++){
			char[] tmpStringAc = new char[lengthA];
			int inputPoint = 0;
			for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			}
			String tmpStringA = new String(tmpStringAc);
			if(tmpStringA.equals(stringB)){
				match = true;
				break;
			}
		}
		System.out.println(match?"Yes":"No");
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String stringA = sc.next();
		String stringB = sc.next();
		sc.close();
		int lengthA = stringA.length();	
		boolean match = false;
		char[] chars = new char[lengthA];
		for(int a = 0; a < lengthA; a++){
			chars[a] = stringA.charAt(a);
		}
		for(int move = 0 ; move < lengthA ; move++){
			char[] tmpStringAc = new char[lengthA];
			int inputPoint = 0;
			for(int inputChar = 0 ; inputChar < lengthA ; inputChar++){
				inputPoint = inputChar + move;
				if(inputPoint>=lengthA){
					inputPoint = inputPoint - lengthA;
				}
				tmpStringAc[inputPoint] = chars[inputChar];
			}
			String tmpStringA = new String(tmpStringAc);
			if(tmpStringA.equals(stringB)){
				match = true;
				break;
			}
		}
		System.out.println(match?"Yes":"No");
	}
}