import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		String s = sc.next();
		char[] a = s.toCharArray();
		char[] b = sc.next().toCharArray();
		sc.close();
		boolean you = false;
		for(int i = 0 ; i < s.length() ; i++){
			boolean che = true;
			for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			}
			if(che) you = true;
		}
		if(you) ou.println("Yes");
		else ou.println("No");
		ou.flush();
	}
} import java.util.*; util.* java import java.io.*; io.* java import java.math.*; math.* java public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		String s = sc.next();
		char[] a = s.toCharArray();
		char[] b = sc.next().toCharArray();
		sc.close();
		boolean you = false;
		for(int i = 0 ; i < s.length() ; i++){
			boolean che = true;
			for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			}
			if(che) you = true;
		}
		if(you) ou.println("Yes");
		else ou.println("No");
		ou.flush();
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		String s = sc.next();
		char[] a = s.toCharArray();
		char[] b = sc.next().toCharArray();
		sc.close();
		boolean you = false;
		for(int i = 0 ; i < s.length() ; i++){
			boolean che = true;
			for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			}
			if(che) you = true;
		}
		if(you) ou.println("Yes");
		else ou.println("No");
		ou.flush();
	} main {
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		String s = sc.next();
		char[] a = s.toCharArray();
		char[] b = sc.next().toCharArray();
		sc.close();
		boolean you = false;
		for(int i = 0 ; i < s.length() ; i++){
			boolean che = true;
			for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			}
			if(che) you = true;
		}
		if(you) ou.println("Yes");
		else ou.println("No");
		ou.flush();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter ou = new PrintWriter(System.out); ou new PrintWriter(System.out) String s = sc.next(); s sc.next() sc.next sc char[] a = s.toCharArray(); a s.toCharArray() s.toCharArray s char[] b = sc.next().toCharArray(); b sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc sc.close() sc.close sc boolean you = false; you false for(int i = 0 ; i < s.length() ; i++){
			boolean che = true;
			for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			}
			if(che) you = true;
		} int i = 0 ; int i = 0 ; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			boolean che = true;
			for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			}
			if(che) you = true;
		} {
			boolean che = true;
			for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			}
			if(che) you = true;
		} boolean che = true; che true for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			} int j = 0 ; int j = 0 ; j 0 j < s.length() j s.length() s.length s j++ j++ j {
				if(a[j] != b[(j + i) % s.length()]) che = false;
			} {
				if(a[j] != b[(j + i) % s.length()]) che = false;
			} if(a[j] != b[(j + i) % s.length()]) che = false; a[j] != b[(j + i) % s.length()] a[j] a j b[(j + i) % s.length()] b (j + i) % s.length() (j + i) j i s.length() s.length s che = false che false if(che) you = true; che you = true you true if(you) ou.println("Yes");
		else ou.println("No"); you ou.println("Yes") ou.println ou "Yes" ou.println("No") ou.println ou "No" ou.flush() ou.flush ou String[] args args public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		String s = sc.next();
		char[] a = s.toCharArray();
		char[] b = sc.next().toCharArray();
		sc.close();
		boolean you = false;
		for(int i = 0 ; i < s.length() ; i++){
			boolean che = true;
			for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			}
			if(che) you = true;
		}
		if(you) ou.println("Yes");
		else ou.println("No");
		ou.flush();
	}
} public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		String s = sc.next();
		char[] a = s.toCharArray();
		char[] b = sc.next().toCharArray();
		sc.close();
		boolean you = false;
		for(int i = 0 ; i < s.length() ; i++){
			boolean che = true;
			for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			}
			if(che) you = true;
		}
		if(you) ou.println("Yes");
		else ou.println("No");
		ou.flush();
	}
} Main
import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		String s = sc.next();
		char[] a = s.toCharArray();
		char[] b = sc.next().toCharArray();
		sc.close();
		boolean you = false;
		for(int i = 0 ; i < s.length() ; i++){
			boolean che = true;
			for(int j = 0 ; j < s.length() ; j++){
				if(a[j] != b[(j + i) % s.length()]) che = false;
			}
			if(che) you = true;
		}
		if(you) ou.println("Yes");
		else ou.println("No");
		ou.flush();
	}
}