import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        List <String> sList = new LinkedList<>(Arrays.asList(t.split("")));
        List <String> tList = new LinkedList<>(Arrays.asList(s.split("")));
        int flag = 0;
        int n = tList.size();
        for(int i = 0; i < n; i++){
            String a = tList.remove(n-1);
            tList.add(0,a);
            if(tList.equals(sList)){
                flag = 1;
                break;
            }
        }
        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) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        List <String> sList = new LinkedList<>(Arrays.asList(t.split("")));
        List <String> tList = new LinkedList<>(Arrays.asList(s.split("")));
        int flag = 0;
        int n = tList.size();
        for(int i = 0; i < n; i++){
            String a = tList.remove(n-1);
            tList.add(0,a);
            if(tList.equals(sList)){
                flag = 1;
                break;
            }
        }
        if(flag == 1) System.out.println("Yes");
        else System.out.println("No");
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        List <String> sList = new LinkedList<>(Arrays.asList(t.split("")));
        List <String> tList = new LinkedList<>(Arrays.asList(s.split("")));
        int flag = 0;
        int n = tList.size();
        for(int i = 0; i < n; i++){
            String a = tList.remove(n-1);
            tList.add(0,a);
            if(tList.equals(sList)){
                flag = 1;
                break;
            }
        }
        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();
        List <String> sList = new LinkedList<>(Arrays.asList(t.split("")));
        List <String> tList = new LinkedList<>(Arrays.asList(s.split("")));
        int flag = 0;
        int n = tList.size();
        for(int i = 0; i < n; i++){
            String a = tList.remove(n-1);
            tList.add(0,a);
            if(tList.equals(sList)){
                flag = 1;
                break;
            }
        }
        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(); t sc.nextLine() sc.nextLine sc List <String> sList = new LinkedList<>(Arrays.asList(t.split(""))); sList new LinkedList<>(Arrays.asList(t.split(""))) List <String> tList = new LinkedList<>(Arrays.asList(s.split(""))); tList new LinkedList<>(Arrays.asList(s.split(""))) int flag = 0; flag 0 int n = tList.size(); n tList.size() tList.size tList for(int i = 0; i < n; i++){
            String a = tList.remove(n-1);
            tList.add(0,a);
            if(tList.equals(sList)){
                flag = 1;
                break;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String a = tList.remove(n-1);
            tList.add(0,a);
            if(tList.equals(sList)){
                flag = 1;
                break;
            }
        } {
            String a = tList.remove(n-1);
            tList.add(0,a);
            if(tList.equals(sList)){
                flag = 1;
                break;
            }
        } String a = tList.remove(n-1); a tList.remove(n-1) tList.remove tList n-1 n 1 tList.add(0,a) tList.add tList 0 a if(tList.equals(sList)){
                flag = 1;
                break;
            } tList.equals(sList) tList.equals tList sList {
                flag = 1;
                break;
            } flag = 1 flag 1 break; if(flag == 1) System.out.println("Yes");
        else System.out.println("No"); flag == 1 flag 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" 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) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        List <String> sList = new LinkedList<>(Arrays.asList(t.split("")));
        List <String> tList = new LinkedList<>(Arrays.asList(s.split("")));
        int flag = 0;
        int n = tList.size();
        for(int i = 0; i < n; i++){
            String a = tList.remove(n-1);
            tList.add(0,a);
            if(tList.equals(sList)){
                flag = 1;
                break;
            }
        }
        if(flag == 1) System.out.println("Yes");
        else System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        List <String> sList = new LinkedList<>(Arrays.asList(t.split("")));
        List <String> tList = new LinkedList<>(Arrays.asList(s.split("")));
        int flag = 0;
        int n = tList.size();
        for(int i = 0; i < n; i++){
            String a = tList.remove(n-1);
            tList.add(0,a);
            if(tList.equals(sList)){
                flag = 1;
                break;
            }
        }
        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) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        List <String> sList = new LinkedList<>(Arrays.asList(t.split("")));
        List <String> tList = new LinkedList<>(Arrays.asList(s.split("")));
        int flag = 0;
        int n = tList.size();
        for(int i = 0; i < n; i++){
            String a = tList.remove(n-1);
            tList.add(0,a);
            if(tList.equals(sList)){
                flag = 1;
                break;
            }
        }
        if(flag == 1) System.out.println("Yes");
        else System.out.println("No");
    }
}