import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[]ss = S.toCharArray();
        String T = sc.next();
        char[]t = T.toCharArray();

        int cou = 0;
        for(int i=0; i<S.length(); i++) {
        for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        }
        }
        if(cou > 0){
            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 sc = new Scanner(System.in);
        String S = sc.next();
        char[]ss = S.toCharArray();
        String T = sc.next();
        char[]t = T.toCharArray();

        int cou = 0;
        for(int i=0; i<S.length(); i++) {
        for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        }
        }
        if(cou > 0){
            System.out.println("Yes");    
        }else{
            System.out.println("No");
    }
}
} Main public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[]ss = S.toCharArray();
        String T = sc.next();
        char[]t = T.toCharArray();

        int cou = 0;
        for(int i=0; i<S.length(); i++) {
        for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        }
        }
        if(cou > 0){
            System.out.println("Yes");    
        }else{
            System.out.println("No");
    }
} main {
    
    Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[]ss = S.toCharArray();
        String T = sc.next();
        char[]t = T.toCharArray();

        int cou = 0;
        for(int i=0; i<S.length(); i++) {
        for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        }
        }
        if(cou > 0){
            System.out.println("Yes");    
        }else{
            System.out.println("No");
    }
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc char[]ss = S.toCharArray(); ss S.toCharArray() S.toCharArray S String T = sc.next(); T sc.next() sc.next sc char[]t = T.toCharArray(); t T.toCharArray() T.toCharArray T int cou = 0; cou 0 for(int i=0; i<S.length(); i++) {
        for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        }
        } int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
        for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        }
        } {
        for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        }
        } for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        } int j=0; int j=0; j 0 j<T.length() j T.length() T.length T j++ j++ j {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        } {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        } if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	} ss[i] == t[j] ss[i] ss i t[j] t j {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	} if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		} S.equals (T.substring(j, T.length()) + T.substring(0, j)) S.equals S T.substring(j, T.length()) + T.substring(0, j) T.substring(j, T.length()) T.substring T j T.length() T.length T T.substring(0, j) T.substring T 0 j {
        			cou++;
        		} cou++ cou if(cou > 0){
            System.out.println("Yes");    
        }else{
            System.out.println("No");
    } cou > 0 cou 0 {
            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 sc = new Scanner(System.in);
        String S = sc.next();
        char[]ss = S.toCharArray();
        String T = sc.next();
        char[]t = T.toCharArray();

        int cou = 0;
        for(int i=0; i<S.length(); i++) {
        for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        }
        }
        if(cou > 0){
            System.out.println("Yes");    
        }else{
            System.out.println("No");
    }
}
} public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[]ss = S.toCharArray();
        String T = sc.next();
        char[]t = T.toCharArray();

        int cou = 0;
        for(int i=0; i<S.length(); i++) {
        for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        }
        }
        if(cou > 0){
            System.out.println("Yes");    
        }else{
            System.out.println("No");
    }
}
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[]ss = S.toCharArray();
        String T = sc.next();
        char[]t = T.toCharArray();

        int cou = 0;
        for(int i=0; i<S.length(); i++) {
        for(int j=0; j<T.length(); j++) {	 
      	if(ss[i] == t[j]) {
      		if(S.equals (T.substring(j, T.length()) + T.substring(0, j))) {
        			cou++;
        		}
        	}
        }
        }
        if(cou > 0){
            System.out.println("Yes");    
        }else{
            System.out.println("No");
    }
}
}