#include <iostream>
#include <cstring>
using namespace std;


bool compare(char a[], char b[], int a_start, int len_a, int len_b){
    int j=0;
    for(int i=a_start; i <= len_a-1; i++){
        if(a[i] != b[j]){
            return false;
        }
        j++;
    }
    for(int i=0; i < a_start; i++){
        if(a[i] != b[j]){
            return false;
        }
        j++;
    }
    return true;
}

int main()
{
    char a[100];
    char b[100];
    cin>>a;
    cin>>b;
    int len_a = strlen(a);
    int len_b = strlen(b);
    if(len_a == 0 && len_b == 0){
        cout << "No";
        return 0;
    }
    for(int i = len_a-1; i>=0; i--){
        int result = compare(a,b,i,len_a, len_b);
        if(result == true){
           cout << "Yes";
           return 0;
        }
    }
    cout << "No";
    return 0;
}
