import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
char[] a = s.toCharArray();
char[] b = t.toCharArray();
boolean ok = true;
int n = s.length();
for(int i = 0;i < n;i++) {
	ok = true;
	for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	}
	for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	}
	if(ok)break;
}
System.out.println(ok? "Yes":"No");
}} import java.util.Scanner; Scanner java.util public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
char[] a = s.toCharArray();
char[] b = t.toCharArray();
boolean ok = true;
int n = s.length();
for(int i = 0;i < n;i++) {
	ok = true;
	for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	}
	for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	}
	if(ok)break;
}
System.out.println(ok? "Yes":"No");
}} Main public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
char[] a = s.toCharArray();
char[] b = t.toCharArray();
boolean ok = true;
int n = s.length();
for(int i = 0;i < n;i++) {
	ok = true;
	for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	}
	for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	}
	if(ok)break;
}
System.out.println(ok? "Yes":"No");
} main {
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
char[] a = s.toCharArray();
char[] b = t.toCharArray();
boolean ok = true;
int n = s.length();
for(int i = 0;i < n;i++) {
	ok = true;
	for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	}
	for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	}
	if(ok)break;
}
System.out.println(ok? "Yes":"No");
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc char[] a = s.toCharArray(); a s.toCharArray() s.toCharArray s char[] b = t.toCharArray(); b t.toCharArray() t.toCharArray t boolean ok = true; ok true int n = s.length(); n s.length() s.length s for(int i = 0;i < n;i++) {
	ok = true;
	for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	}
	for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	}
	if(ok)break;
} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
	ok = true;
	for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	}
	for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	}
	if(ok)break;
} {
	ok = true;
	for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	}
	for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	}
	if(ok)break;
} ok = true ok true for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	} int j = 0; int j = 0; j 0 j < n-i j n-i n i j++ j++ j {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	} {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	} if(a[j] != b[j+i]) {
			ok = false;
			break;
		} a[j] != b[j+i] a[j] a j b[j+i] b j+i j i {
			ok = false;
			break;
		} ok = false ok false break; for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	} int j = n-i; int j = n-i; j n-i n i j < n j n j++ j++ j {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	} {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	} if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		} a[j] != b[j-n+i] a[j] a j b[j-n+i] b j-n+i j-n j n i {
			ok = false;
			break;
		} ok = false ok false break; if(ok)break; ok break; System.out.println(ok? "Yes":"No") System.out.println System.out System System.out ok? "Yes":"No" ok "Yes" "No" String[] args args public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
char[] a = s.toCharArray();
char[] b = t.toCharArray();
boolean ok = true;
int n = s.length();
for(int i = 0;i < n;i++) {
	ok = true;
	for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	}
	for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	}
	if(ok)break;
}
System.out.println(ok? "Yes":"No");
}} public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
char[] a = s.toCharArray();
char[] b = t.toCharArray();
boolean ok = true;
int n = s.length();
for(int i = 0;i < n;i++) {
	ok = true;
	for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	}
	for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	}
	if(ok)break;
}
System.out.println(ok? "Yes":"No");
}} Main
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
char[] a = s.toCharArray();
char[] b = t.toCharArray();
boolean ok = true;
int n = s.length();
for(int i = 0;i < n;i++) {
	ok = true;
	for(int j = 0;j < n-i;j++) {
		if(a[j] != b[j+i]) {
			ok = false;
			break;
		}
	}
	for(int j = n-i;j < n;j++) {
		if(a[j] != b[j-n+i]) {
			ok = false;
			break;
		}
	}
	if(ok)break;
}
System.out.println(ok? "Yes":"No");
}}