import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		String s = sc.next(); s += s;
		String t = sc.next();
		System.out.println(s.contains(t)?"Yes":"No");
		
	}
} import java.util.*; util.* java class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		String s = sc.next(); s += s;
		String t = sc.next();
		System.out.println(s.contains(t)?"Yes":"No");
		
	}
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		
		String s = sc.next(); s += s;
		String t = sc.next();
		System.out.println(s.contains(t)?"Yes":"No");
		
	} main {
		
		String s = sc.next(); s += s;
		String t = sc.next();
		System.out.println(s.contains(t)?"Yes":"No");
		
	} String s = sc.next(); s sc.next() sc.next sc s += s s s String t = sc.next(); t sc.next() sc.next sc System.out.println(s.contains(t)?"Yes":"No") System.out.println System.out System System.out s.contains(t)?"Yes":"No" s.contains(t) s.contains s t "Yes" "No" String[] args args
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		String s = sc.next(); s += s;
		String t = sc.next();
		System.out.println(s.contains(t)?"Yes":"No");
		
	}
}
