import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int ls,lp,i,j=0,f=0;
        String s,p;
        s=scan.next();
        p=scan.next();
        ls=s.length();
        lp=p.length();
        s=s+s+s;
        for(i=0;i<ls;i++) {
        	if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	}
        	if(j==lp) {
        		f=1;
        		break;
        	}
        }
        if(f==1) {
        	System.out.println("Yes");
        }
        else {
        	System.out.println("No");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int ls,lp,i,j=0,f=0;
        String s,p;
        s=scan.next();
        p=scan.next();
        ls=s.length();
        lp=p.length();
        s=s+s+s;
        for(i=0;i<ls;i++) {
        	if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	}
        	if(j==lp) {
        		f=1;
        		break;
        	}
        }
        if(f==1) {
        	System.out.println("Yes");
        }
        else {
        	System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int ls,lp,i,j=0,f=0;
        String s,p;
        s=scan.next();
        p=scan.next();
        ls=s.length();
        lp=p.length();
        s=s+s+s;
        for(i=0;i<ls;i++) {
        	if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	}
        	if(j==lp) {
        		f=1;
        		break;
        	}
        }
        if(f==1) {
        	System.out.println("Yes");
        }
        else {
        	System.out.println("No");
        }
    } main {
        Scanner scan=new Scanner(System.in);
        int ls,lp,i,j=0,f=0;
        String s,p;
        s=scan.next();
        p=scan.next();
        ls=s.length();
        lp=p.length();
        s=s+s+s;
        for(i=0;i<ls;i++) {
        	if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	}
        	if(j==lp) {
        		f=1;
        		break;
        	}
        }
        if(f==1) {
        	System.out.println("Yes");
        }
        else {
        	System.out.println("No");
        }
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int ls ls lp lp i i j=0 j 0 f=0; f 0 String s s p; p s=scan.next() s scan.next() scan.next scan p=scan.next() p scan.next() scan.next scan ls=s.length() ls s.length() s.length s lp=p.length() lp p.length() p.length p s=s+s+s s s+s+s s+s+s s s s for(i=0;i<ls;i++) {
        	if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	}
        	if(j==lp) {
        		f=1;
        		break;
        	}
        } i=0; i=0 i 0 i<ls i ls i++ i++ i {
        	if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	}
        	if(j==lp) {
        		f=1;
        		break;
        	}
        } {
        	if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	}
        	if(j==lp) {
        		f=1;
        		break;
        	}
        } if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	} s.charAt(i)==p.charAt(0) s.charAt(i) s.charAt s i p.charAt(0) p.charAt p 0 {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	} for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		} j=1; j=1 j 1 j<lp j lp j++ j++ j {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		} {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		} if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			} s.charAt(i+j)!=p.charAt(j) s.charAt(i+j) s.charAt s i+j i j p.charAt(j) p.charAt p j {
        				break;
        			} break; if(j==lp) {
        		f=1;
        		break;
        	} j==lp j lp {
        		f=1;
        		break;
        	} f=1 f 1 break; if(f==1) {
        	System.out.println("Yes");
        }
        else {
        	System.out.println("No");
        } f==1 f 1 {
        	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 public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int ls,lp,i,j=0,f=0;
        String s,p;
        s=scan.next();
        p=scan.next();
        ls=s.length();
        lp=p.length();
        s=s+s+s;
        for(i=0;i<ls;i++) {
        	if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	}
        	if(j==lp) {
        		f=1;
        		break;
        	}
        }
        if(f==1) {
        	System.out.println("Yes");
        }
        else {
        	System.out.println("No");
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int ls,lp,i,j=0,f=0;
        String s,p;
        s=scan.next();
        p=scan.next();
        ls=s.length();
        lp=p.length();
        s=s+s+s;
        for(i=0;i<ls;i++) {
        	if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	}
        	if(j==lp) {
        		f=1;
        		break;
        	}
        }
        if(f==1) {
        	System.out.println("Yes");
        }
        else {
        	System.out.println("No");
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int ls,lp,i,j=0,f=0;
        String s,p;
        s=scan.next();
        p=scan.next();
        ls=s.length();
        lp=p.length();
        s=s+s+s;
        for(i=0;i<ls;i++) {
        	if(s.charAt(i)==p.charAt(0)) {
        		for(j=1;j<lp;j++) {
        			if(s.charAt(i+j)!=p.charAt(j)) {
        				break;
        			}
        		}
        	}
        	if(j==lp) {
        		f=1;
        		break;
        	}
        }
        if(f==1) {
        	System.out.println("Yes");
        }
        else {
        	System.out.println("No");
        }
    }
}
