import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=null;
		String p=null;
		int flag=0;
		try {
			s=br.readLine().toLowerCase();
			p=br.readLine().toLowerCase();
		} catch (Exception e) {
			System.err.println("Error");
			// TODO: handle exception
		}
		s=s+s;
		for(int i=0;i<s.length()/2;i++){
			String str=s.substring(i, i+p.length());
			if(str.equals(p)) {
				flag=1;
			}
		}
		
		if(flag==1) System.out.println("Yes");
		else System.out.println("No");
	}
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=null;
		String p=null;
		int flag=0;
		try {
			s=br.readLine().toLowerCase();
			p=br.readLine().toLowerCase();
		} catch (Exception e) {
			System.err.println("Error");
			// TODO: handle exception
		}
		s=s+s;
		for(int i=0;i<s.length()/2;i++){
			String str=s.substring(i, i+p.length());
			if(str.equals(p)) {
				flag=1;
			}
		}
		
		if(flag==1) System.out.println("Yes");
		else System.out.println("No");
	}
} Main public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=null;
		String p=null;
		int flag=0;
		try {
			s=br.readLine().toLowerCase();
			p=br.readLine().toLowerCase();
		} catch (Exception e) {
			System.err.println("Error");
			// TODO: handle exception
		}
		s=s+s;
		for(int i=0;i<s.length()/2;i++){
			String str=s.substring(i, i+p.length());
			if(str.equals(p)) {
				flag=1;
			}
		}
		
		if(flag==1) System.out.println("Yes");
		else System.out.println("No");
	} main {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=null;
		String p=null;
		int flag=0;
		try {
			s=br.readLine().toLowerCase();
			p=br.readLine().toLowerCase();
		} catch (Exception e) {
			System.err.println("Error");
			// TODO: handle exception
		}
		s=s+s;
		for(int i=0;i<s.length()/2;i++){
			String str=s.substring(i, i+p.length());
			if(str.equals(p)) {
				flag=1;
			}
		}
		
		if(flag==1) System.out.println("Yes");
		else System.out.println("No");
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s=null; s null String p=null; p null int flag=0; flag 0 try {
			s=br.readLine().toLowerCase();
			p=br.readLine().toLowerCase();
		} catch (Exception e) {
			System.err.println("Error");
			// TODO: handle exception
		} catch (Exception e) {
			System.err.println("Error");
			// TODO: handle exception
		} Exception e {
			System.err.println("Error");
			// TODO: handle exception
		} System.err.println("Error") System.err.println System.err System System.err "Error" {
			s=br.readLine().toLowerCase();
			p=br.readLine().toLowerCase();
		} s=br.readLine().toLowerCase() s br.readLine().toLowerCase() br.readLine().toLowerCase br.readLine() br.readLine br p=br.readLine().toLowerCase() p br.readLine().toLowerCase() br.readLine().toLowerCase br.readLine() br.readLine br s=s+s s s+s s s for(int i=0;i<s.length()/2;i++){
			String str=s.substring(i, i+p.length());
			if(str.equals(p)) {
				flag=1;
			}
		} int i=0; int i=0; i 0 i<s.length()/2 i s.length()/2 s.length() s.length s 2 i++ i++ i {
			String str=s.substring(i, i+p.length());
			if(str.equals(p)) {
				flag=1;
			}
		} {
			String str=s.substring(i, i+p.length());
			if(str.equals(p)) {
				flag=1;
			}
		} String str=s.substring(i, i+p.length()); str s.substring(i, i+p.length()) s.substring s i i+p.length() i p.length() p.length p if(str.equals(p)) {
				flag=1;
			} str.equals(p) str.equals str p {
				flag=1;
			} flag=1 flag 1 if(flag==1) System.out.println("Yes");
		else System.out.println("No"); flag==1 flag 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" 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) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=null;
		String p=null;
		int flag=0;
		try {
			s=br.readLine().toLowerCase();
			p=br.readLine().toLowerCase();
		} catch (Exception e) {
			System.err.println("Error");
			// TODO: handle exception
		}
		s=s+s;
		for(int i=0;i<s.length()/2;i++){
			String str=s.substring(i, i+p.length());
			if(str.equals(p)) {
				flag=1;
			}
		}
		
		if(flag==1) System.out.println("Yes");
		else System.out.println("No");
	}
} public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=null;
		String p=null;
		int flag=0;
		try {
			s=br.readLine().toLowerCase();
			p=br.readLine().toLowerCase();
		} catch (Exception e) {
			System.err.println("Error");
			// TODO: handle exception
		}
		s=s+s;
		for(int i=0;i<s.length()/2;i++){
			String str=s.substring(i, i+p.length());
			if(str.equals(p)) {
				flag=1;
			}
		}
		
		if(flag==1) System.out.println("Yes");
		else System.out.println("No");
	}
} Main
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=null;
		String p=null;
		int flag=0;
		try {
			s=br.readLine().toLowerCase();
			p=br.readLine().toLowerCase();
		} catch (Exception e) {
			System.err.println("Error");
			// TODO: handle exception
		}
		s=s+s;
		for(int i=0;i<s.length()/2;i++){
			String str=s.substring(i, i+p.length());
			if(str.equals(p)) {
				flag=1;
			}
		}
		
		if(flag==1) System.out.println("Yes");
		else System.out.println("No");
	}
}