import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s=br.readLine();
        String p=br.readLine();
    	boolean m=false;
    	for(int i=0;i<s.length();i++){
        	if(s.charAt(i)==p.charAt(0)){
        		if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		}
        		if(m) break;
        	}
    	}
    	if(m){
    		System.out.println("Yes");
    	}else{
        	System.out.println("No");
    	}        
	}
} import java.io.*; io.* java class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s=br.readLine();
        String p=br.readLine();
    	boolean m=false;
    	for(int i=0;i<s.length();i++){
        	if(s.charAt(i)==p.charAt(0)){
        		if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		}
        		if(m) break;
        	}
    	}
    	if(m){
    		System.out.println("Yes");
    	}else{
        	System.out.println("No");
    	}        
	}
} Main public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s=br.readLine();
        String p=br.readLine();
    	boolean m=false;
    	for(int i=0;i<s.length();i++){
        	if(s.charAt(i)==p.charAt(0)){
        		if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		}
        		if(m) break;
        	}
    	}
    	if(m){
    		System.out.println("Yes");
    	}else{
        	System.out.println("No");
    	}        
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s=br.readLine();
        String p=br.readLine();
    	boolean m=false;
    	for(int i=0;i<s.length();i++){
        	if(s.charAt(i)==p.charAt(0)){
        		if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		}
        		if(m) break;
        	}
    	}
    	if(m){
    		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=br.readLine(); s br.readLine() br.readLine br String p=br.readLine(); p br.readLine() br.readLine br boolean m=false; m false for(int i=0;i<s.length();i++){
        	if(s.charAt(i)==p.charAt(0)){
        		if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		}
        		if(m) break;
        	}
    	} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
        	if(s.charAt(i)==p.charAt(0)){
        		if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		}
        		if(m) break;
        	}
    	} {
        	if(s.charAt(i)==p.charAt(0)){
        		if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		}
        		if(m) break;
        	}
    	} if(s.charAt(i)==p.charAt(0)){
        		if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		}
        		if(m) break;
        	} s.charAt(i)==p.charAt(0) s.charAt(i) s.charAt s i p.charAt(0) p.charAt p 0 {
        		if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		}
        		if(m) break;
        	} if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		} p.length()>1 p.length() p.length p 1 {
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		} int k=i+1; k i+1 i 1 for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		} int j=1; int j=1; j 1 j<p.length() j p.length() p.length p j++ j++ j {
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		} {
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		} if(k>=s.length()) k=0; k>=s.length() k s.length() s.length s k=0 k 0 if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			} s.charAt(k)==p.charAt(j) s.charAt(k) s.charAt s k p.charAt(j) p.charAt p j {
            				m=true;
            				k++;
            			} m=true m true k++ k {
            				m=false;
            				break;
            			} m=false m false break; {
        			m=true;
        		} m=true m true if(m) break; m break; if(m){
    		System.out.println("Yes");
    	}else{
        	System.out.println("No");
    	} m {
    		System.out.println("Yes");
    	} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
        	System.out.println("No");
    	} System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s=br.readLine();
        String p=br.readLine();
    	boolean m=false;
    	for(int i=0;i<s.length();i++){
        	if(s.charAt(i)==p.charAt(0)){
        		if(p.length()>1){
            		int k=i+1;
            		for(int j=1;j<p.length();j++){
        				if(k>=s.length()) k=0;
            			if(s.charAt(k)==p.charAt(j)){
            				m=true;
            				k++;
            			}else{
            				m=false;
            				break;
            			}
            		}
        		}else{
        			m=true;
        		}
        		if(m) break;
        	}
    	}
    	if(m){
    		System.out.println("Yes");
    	}else{
        	System.out.println("No");
    	}        
	}
}