import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] t = sc.nextLine().split("");
        int flag = 0;
        for(int i = 0;i<s.length();i++){            
            StringBuilder sb = new StringBuilder();
            for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            }
            if(s.equals(sb.toString())){
                flag++;
                break;
            }
            sb.setLength(0);
        }
        if(flag == 1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] t = sc.nextLine().split("");
        int flag = 0;
        for(int i = 0;i<s.length();i++){            
            StringBuilder sb = new StringBuilder();
            for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            }
            if(s.equals(sb.toString())){
                flag++;
                break;
            }
            sb.setLength(0);
        }
        if(flag == 1){
            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.nextLine();
        String[] t = sc.nextLine().split("");
        int flag = 0;
        for(int i = 0;i<s.length();i++){            
            StringBuilder sb = new StringBuilder();
            for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            }
            if(s.equals(sb.toString())){
                flag++;
                break;
            }
            sb.setLength(0);
        }
        if(flag == 1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] t = sc.nextLine().split("");
        int flag = 0;
        for(int i = 0;i<s.length();i++){            
            StringBuilder sb = new StringBuilder();
            for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            }
            if(s.equals(sb.toString())){
                flag++;
                break;
            }
            sb.setLength(0);
        }
        if(flag == 1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String[] t = sc.nextLine().split(""); t sc.nextLine().split("") sc.nextLine().split sc.nextLine() sc.nextLine sc "" int flag = 0; flag 0 for(int i = 0;i<s.length();i++){            
            StringBuilder sb = new StringBuilder();
            for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            }
            if(s.equals(sb.toString())){
                flag++;
                break;
            }
            sb.setLength(0);
        } int i = 0; int i = 0; i 0 i<s.length() i s.length() s.length s i++ i++ i {            
            StringBuilder sb = new StringBuilder();
            for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            }
            if(s.equals(sb.toString())){
                flag++;
                break;
            }
            sb.setLength(0);
        } {            
            StringBuilder sb = new StringBuilder();
            for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            }
            if(s.equals(sb.toString())){
                flag++;
                break;
            }
            sb.setLength(0);
        } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            } int j = 0; int j = 0; j 0 j<s.length() j s.length() s.length s j++ j++ j {
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            } {
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            } if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                } j-i<0 j-i j i 0 {
                    sb.append(t[j-i+s.length()]);
                } sb.append(t[j-i+s.length()]) sb.append sb t[j-i+s.length()] t j-i+s.length() j-i j i s.length() s.length s {
                    sb.append(t[j-i]);
                } sb.append(t[j-i]) sb.append sb t[j-i] t j-i j i if(s.equals(sb.toString())){
                flag++;
                break;
            } s.equals(sb.toString()) s.equals s sb.toString() sb.toString sb {
                flag++;
                break;
            } flag++ flag break; sb.setLength(0) sb.setLength sb 0 if(flag == 1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } flag == 1 flag 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 sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] t = sc.nextLine().split("");
        int flag = 0;
        for(int i = 0;i<s.length();i++){            
            StringBuilder sb = new StringBuilder();
            for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            }
            if(s.equals(sb.toString())){
                flag++;
                break;
            }
            sb.setLength(0);
        }
        if(flag == 1){
            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.nextLine();
        String[] t = sc.nextLine().split("");
        int flag = 0;
        for(int i = 0;i<s.length();i++){            
            StringBuilder sb = new StringBuilder();
            for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            }
            if(s.equals(sb.toString())){
                flag++;
                break;
            }
            sb.setLength(0);
        }
        if(flag == 1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] t = sc.nextLine().split("");
        int flag = 0;
        for(int i = 0;i<s.length();i++){            
            StringBuilder sb = new StringBuilder();
            for(int j = 0;j<s.length();j++){
                if(j-i<0){
                    sb.append(t[j-i+s.length()]);
                }else{
                    sb.append(t[j-i]);
                }
            }
            if(s.equals(sb.toString())){
                flag++;
                break;
            }
            sb.setLength(0);
        }
        if(flag == 1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}