#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
char a[32],b[32];
int t=0;
char p,k,m;
bool mb=false;
cin>>a>>b;
if(strlen(a)<strlen(b))swap(a,b);
for(int i=0;i<strlen(a);i++)
{
m=a[strlen(a)-1];
k=a[0];
a[0]=a[1];
a[strlen(a)-1]=k;
for(int j=1;j<strlen(a)-1;j++)
a[j]=a[j+1];
a[strlen(a)-2]=m;
if(strstr(a,b)!=NULL)
{
return cout<<"true",0;
}
}
cout<<"false";
return 0;
}