import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String ans="No";
String s=sc.next();
String t=sc.next();
int n=s.length();
int temp=0;
int count=0;
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    }
if(count==n){ans="Yes";break;}
}

System.out.println(ans);


}} import java.util.*; util.* java public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String ans="No";
String s=sc.next();
String t=sc.next();
int n=s.length();
int temp=0;
int count=0;
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    }
if(count==n){ans="Yes";break;}
}

System.out.println(ans);


}} Main public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String ans="No";
String s=sc.next();
String t=sc.next();
int n=s.length();
int temp=0;
int count=0;
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    }
if(count==n){ans="Yes";break;}
}

System.out.println(ans);


} main {
Scanner sc = new Scanner(System.in);
String ans="No";
String s=sc.next();
String t=sc.next();
int n=s.length();
int temp=0;
int count=0;
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    }
if(count==n){ans="Yes";break;}
}

System.out.println(ans);


} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String ans="No"; ans "No" String s=sc.next(); s sc.next() sc.next sc String t=sc.next(); t sc.next() sc.next sc int n=s.length(); n s.length() s.length s int temp=0; temp 0 int count=0; count 0 for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    }
if(count==n){ans="Yes";break;}
} int i=0; int i=0; i 0 i<n i n i++ i++ i {
    for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    }
if(count==n){ans="Yes";break;}
} {
    for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    }
if(count==n){ans="Yes";break;}
} for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    } int j=0; int j=0; j 0 j<n j n j++ j++ j {
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    } {
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    } if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;} s.charAt(j)!=t.charAt((j+temp)%n) s.charAt(j) s.charAt s j t.charAt((j+temp)%n) t.charAt t (j+temp)%n (j+temp) j temp n {temp++;count=0;break;} temp++ temp count=0 count 0 break; {count++;} count++ count if(count==n){ans="Yes";break;} count==n count n {ans="Yes";break;} ans="Yes" ans "Yes" break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String ans="No";
String s=sc.next();
String t=sc.next();
int n=s.length();
int temp=0;
int count=0;
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    }
if(count==n){ans="Yes";break;}
}

System.out.println(ans);


}} public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String ans="No";
String s=sc.next();
String t=sc.next();
int n=s.length();
int temp=0;
int count=0;
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    }
if(count==n){ans="Yes";break;}
}

System.out.println(ans);


}} Main
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String ans="No";
String s=sc.next();
String t=sc.next();
int n=s.length();
int temp=0;
int count=0;
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(s.charAt(j)!=t.charAt((j+temp)%n)){temp++;count=0;break;}else{count++;}
    
    }
if(count==n){ans="Yes";break;}
}

System.out.println(ans);


}}