import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        char[] orgArray = sc.next().toCharArray();
        boolean check = false;

        for(int i=0; i<array.length; i++){
            char[] newArray = new char[array.length];

            for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            }

            char last = newArray[array.length-1];
            for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            }
            array[0] = last;

            check = arrayIsSame(orgArray, array);
            if(check){
                break;
            }
        }

        if(check) System.out.println("Yes");
        else System.out.println("No");
    }

    boolean arrayIsSame(char[] orgArray, char[] newArray){
        for(int i=0; i<orgArray.length; i++){
            if(orgArray[i] != newArray[i]){
                return false;
            }
        }
        return true;
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.math.BigDecimal; BigDecimal java.math import java.nio.charset.StandardCharsets; StandardCharsets java.nio.charset import java.util.*; util.* java public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        char[] orgArray = sc.next().toCharArray();
        boolean check = false;

        for(int i=0; i<array.length; i++){
            char[] newArray = new char[array.length];

            for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            }

            char last = newArray[array.length-1];
            for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            }
            array[0] = last;

            check = arrayIsSame(orgArray, array);
            if(check){
                break;
            }
        }

        if(check) System.out.println("Yes");
        else System.out.println("No");
    }

    boolean arrayIsSame(char[] orgArray, char[] newArray){
        for(int i=0; i<orgArray.length; i++){
            if(orgArray[i] != newArray[i]){
                return false;
            }
        }
        return true;
    }
} Main public static void main(String[] args) throws IOException {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args void run() {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        char[] orgArray = sc.next().toCharArray();
        boolean check = false;

        for(int i=0; i<array.length; i++){
            char[] newArray = new char[array.length];

            for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            }

            char last = newArray[array.length-1];
            for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            }
            array[0] = last;

            check = arrayIsSame(orgArray, array);
            if(check){
                break;
            }
        }

        if(check) System.out.println("Yes");
        else System.out.println("No");
    } run {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        char[] orgArray = sc.next().toCharArray();
        boolean check = false;

        for(int i=0; i<array.length; i++){
            char[] newArray = new char[array.length];

            for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            }

            char last = newArray[array.length-1];
            for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            }
            array[0] = last;

            check = arrayIsSame(orgArray, array);
            if(check){
                break;
            }
        }

        if(check) System.out.println("Yes");
        else System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] array = sc.next().toCharArray(); array sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char[] orgArray = sc.next().toCharArray(); orgArray sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc boolean check = false; check false for(int i=0; i<array.length; i++){
            char[] newArray = new char[array.length];

            for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            }

            char last = newArray[array.length-1];
            for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            }
            array[0] = last;

            check = arrayIsSame(orgArray, array);
            if(check){
                break;
            }
        } int i=0; int i=0; i 0 i<array.length i array.length array array.length i++ i++ i {
            char[] newArray = new char[array.length];

            for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            }

            char last = newArray[array.length-1];
            for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            }
            array[0] = last;

            check = arrayIsSame(orgArray, array);
            if(check){
                break;
            }
        } {
            char[] newArray = new char[array.length];

            for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            }

            char last = newArray[array.length-1];
            for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            }
            array[0] = last;

            check = arrayIsSame(orgArray, array);
            if(check){
                break;
            }
        } char[] newArray = new char[array.length]; newArray new char[array.length] array.length array array.length for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            } int j=0; int j=0; j 0 j<array.length j array.length array array.length j++ j++ j {
                newArray[j] = array[j];
            } {
                newArray[j] = array[j];
            } newArray[j] = array[j] newArray[j] newArray j array[j] array j char last = newArray[array.length-1]; last newArray[array.length-1] newArray array.length-1 array.length array array.length 1 for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            } int j=1; int j=1; j 1 j<newArray.length j newArray.length newArray newArray.length j++ j++ j {
                array[j] = newArray[j-1];
            } {
                array[j] = newArray[j-1];
            } array[j] = newArray[j-1] array[j] array j newArray[j-1] newArray j-1 j 1 array[0] = last array[0] array 0 last check = arrayIsSame(orgArray, array) check arrayIsSame(orgArray, array) arrayIsSame orgArray array if(check){
                break;
            } check {
                break;
            } break; if(check) System.out.println("Yes");
        else System.out.println("No"); check 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" boolean arrayIsSame(char[] orgArray, char[] newArray){
        for(int i=0; i<orgArray.length; i++){
            if(orgArray[i] != newArray[i]){
                return false;
            }
        }
        return true;
    } arrayIsSame {
        for(int i=0; i<orgArray.length; i++){
            if(orgArray[i] != newArray[i]){
                return false;
            }
        }
        return true;
    } for(int i=0; i<orgArray.length; i++){
            if(orgArray[i] != newArray[i]){
                return false;
            }
        } int i=0; int i=0; i 0 i<orgArray.length i orgArray.length orgArray orgArray.length i++ i++ i {
            if(orgArray[i] != newArray[i]){
                return false;
            }
        } {
            if(orgArray[i] != newArray[i]){
                return false;
            }
        } if(orgArray[i] != newArray[i]){
                return false;
            } orgArray[i] != newArray[i] orgArray[i] orgArray i newArray[i] newArray i {
                return false;
            } return false; false return true; true char[] orgArray orgArray char[] newArray newArray public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        char[] orgArray = sc.next().toCharArray();
        boolean check = false;

        for(int i=0; i<array.length; i++){
            char[] newArray = new char[array.length];

            for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            }

            char last = newArray[array.length-1];
            for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            }
            array[0] = last;

            check = arrayIsSame(orgArray, array);
            if(check){
                break;
            }
        }

        if(check) System.out.println("Yes");
        else System.out.println("No");
    }

    boolean arrayIsSame(char[] orgArray, char[] newArray){
        for(int i=0; i<orgArray.length; i++){
            if(orgArray[i] != newArray[i]){
                return false;
            }
        }
        return true;
    }
} public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        char[] orgArray = sc.next().toCharArray();
        boolean check = false;

        for(int i=0; i<array.length; i++){
            char[] newArray = new char[array.length];

            for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            }

            char last = newArray[array.length-1];
            for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            }
            array[0] = last;

            check = arrayIsSame(orgArray, array);
            if(check){
                break;
            }
        }

        if(check) System.out.println("Yes");
        else System.out.println("No");
    }

    boolean arrayIsSame(char[] orgArray, char[] newArray){
        for(int i=0; i<orgArray.length; i++){
            if(orgArray[i] != newArray[i]){
                return false;
            }
        }
        return true;
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {

    //グローバル変数を定義

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        char[] orgArray = sc.next().toCharArray();
        boolean check = false;

        for(int i=0; i<array.length; i++){
            char[] newArray = new char[array.length];

            for(int j=0; j<array.length; j++){
                newArray[j] = array[j];
            }

            char last = newArray[array.length-1];
            for(int j=1; j<newArray.length; j++){
                array[j] = newArray[j-1];
            }
            array[0] = last;

            check = arrayIsSame(orgArray, array);
            if(check){
                break;
            }
        }

        if(check) System.out.println("Yes");
        else System.out.println("No");
    }

    boolean arrayIsSame(char[] orgArray, char[] newArray){
        for(int i=0; i<orgArray.length; i++){
            if(orgArray[i] != newArray[i]){
                return false;
            }
        }
        return true;
    }
}
