import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();
        boolean can = false;
        for(int i=0;i<s.length;i++){
            StringBuilder builder = new StringBuilder();
            char[] rotated = rotateArray(s, i);
            if(!builder.append(rotated).toString().equals(t)){
                continue;
            }
            can = true;
            break;
        }
        if(can){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }

    private static char[] rotateArray(char[] c, int d){
        char[] newc = new char[c.length];
        for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        }
        return newc;
    }
    
    private static void sort(int[] d, int left, int right){
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right;
        int tmp;
        while(l<=r){
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();
        boolean can = false;
        for(int i=0;i<s.length;i++){
            StringBuilder builder = new StringBuilder();
            char[] rotated = rotateArray(s, i);
            if(!builder.append(rotated).toString().equals(t)){
                continue;
            }
            can = true;
            break;
        }
        if(can){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }

    private static char[] rotateArray(char[] c, int d){
        char[] newc = new char[c.length];
        for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        }
        return newc;
    }
    
    private static void sort(int[] d, int left, int right){
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right;
        int tmp;
        while(l<=r){
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();
        boolean can = false;
        for(int i=0;i<s.length;i++){
            StringBuilder builder = new StringBuilder();
            char[] rotated = rotateArray(s, i);
            if(!builder.append(rotated).toString().equals(t)){
                continue;
            }
            can = true;
            break;
        }
        if(can){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();
        boolean can = false;
        for(int i=0;i<s.length;i++){
            StringBuilder builder = new StringBuilder();
            char[] rotated = rotateArray(s, i);
            if(!builder.append(rotated).toString().equals(t)){
                continue;
            }
            can = true;
            break;
        }
        if(can){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc boolean can = false; can false for(int i=0;i<s.length;i++){
            StringBuilder builder = new StringBuilder();
            char[] rotated = rotateArray(s, i);
            if(!builder.append(rotated).toString().equals(t)){
                continue;
            }
            can = true;
            break;
        } int i=0; int i=0; i 0 i<s.length i s.length s s.length i++ i++ i {
            StringBuilder builder = new StringBuilder();
            char[] rotated = rotateArray(s, i);
            if(!builder.append(rotated).toString().equals(t)){
                continue;
            }
            can = true;
            break;
        } {
            StringBuilder builder = new StringBuilder();
            char[] rotated = rotateArray(s, i);
            if(!builder.append(rotated).toString().equals(t)){
                continue;
            }
            can = true;
            break;
        } StringBuilder builder = new StringBuilder(); builder new StringBuilder() char[] rotated = rotateArray(s, i); rotated rotateArray(s, i) rotateArray s i if(!builder.append(rotated).toString().equals(t)){
                continue;
            } !builder.append(rotated).toString().equals(t) builder.append(rotated).toString().equals(t) builder.append(rotated).toString().equals builder.append(rotated).toString() builder.append(rotated).toString builder.append(rotated) builder.append builder rotated t {
                continue;
            } continue; can = true can true break; if(can){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } can {
            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 private static char[] rotateArray(char[] c, int d){
        char[] newc = new char[c.length];
        for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        }
        return newc;
    } rotateArray {
        char[] newc = new char[c.length];
        for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        }
        return newc;
    } char[] newc = new char[c.length]; newc new char[c.length] c.length c c.length for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        } int i=0; int i=0; i 0 i<c.length i c.length c c.length i++ i++ i {
            newc[(i+d)%c.length] = c[i];
        } {
            newc[(i+d)%c.length] = c[i];
        } newc[(i+d)%c.length] = c[i] newc[(i+d)%c.length] newc (i+d)%c.length (i+d) i d c.length c c.length c[i] c i return newc; newc char[] c c int d d private static void sort(int[] d, int left, int right){
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right;
        int tmp;
        while(l<=r){
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    } sort {
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right;
        int tmp;
        while(l<=r){
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    } if(left>=right){return;} left>=right left right {return;} return; int p = d[(left+right)/2]; p d[(left+right)/2] d (left+right)/2 (left+right) left right 2 int l=left l left r=right; r right int tmp; tmp while(l<=r){
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        } l<=r l r {
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        } while(d[l]<p){l++;} d[l]<p d[l] d l p {l++;} l++ l while(d[r]>p){r--;} d[r]>p d[r] d r p {r--;} r-- r if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            } l<=r l r {
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            } tmp=d[l] tmp d[l] d l d[l] = d[r] d[l] d l d[r] d r d[r] = tmp d[r] d r tmp l++ l r-- r sort(d, left, r) sort d left r sort(d, l, right) sort d l right int[] d d int left left int right right public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();
        boolean can = false;
        for(int i=0;i<s.length;i++){
            StringBuilder builder = new StringBuilder();
            char[] rotated = rotateArray(s, i);
            if(!builder.append(rotated).toString().equals(t)){
                continue;
            }
            can = true;
            break;
        }
        if(can){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }

    private static char[] rotateArray(char[] c, int d){
        char[] newc = new char[c.length];
        for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        }
        return newc;
    }
    
    private static void sort(int[] d, int left, int right){
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right;
        int tmp;
        while(l<=r){
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();
        boolean can = false;
        for(int i=0;i<s.length;i++){
            StringBuilder builder = new StringBuilder();
            char[] rotated = rotateArray(s, i);
            if(!builder.append(rotated).toString().equals(t)){
                continue;
            }
            can = true;
            break;
        }
        if(can){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }

    private static char[] rotateArray(char[] c, int d){
        char[] newc = new char[c.length];
        for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        }
        return newc;
    }
    
    private static void sort(int[] d, int left, int right){
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right;
        int tmp;
        while(l<=r){
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String t = sc.next();
        boolean can = false;
        for(int i=0;i<s.length;i++){
            StringBuilder builder = new StringBuilder();
            char[] rotated = rotateArray(s, i);
            if(!builder.append(rotated).toString().equals(t)){
                continue;
            }
            can = true;
            break;
        }
        if(can){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }

    private static char[] rotateArray(char[] c, int d){
        char[] newc = new char[c.length];
        for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        }
        return newc;
    }
    
    private static void sort(int[] d, int left, int right){
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right;
        int tmp;
        while(l<=r){
            while(d[l]<p){l++;}
            while(d[r]>p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    }
}