import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.StringBuilder;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String st = sc.readLine();
		String s = sc.readLine();
		st += st;
		Pattern p = Pattern.compile(s);
		Matcher matcher = p.matcher(st);
		if(matcher.find()){
			sb.append("Yes\n");
		}else{
			sb.append("No\n");
		}
		System.out.print(sb);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.lang.StringBuilder; StringBuilder java.lang import java.util.regex.Pattern; Pattern java.util.regex import java.util.regex.Matcher; Matcher java.util.regex public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String st = sc.readLine();
		String s = sc.readLine();
		st += st;
		Pattern p = Pattern.compile(s);
		Matcher matcher = p.matcher(st);
		if(matcher.find()){
			sb.append("Yes\n");
		}else{
			sb.append("No\n");
		}
		System.out.print(sb);
	}
} Main public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String st = sc.readLine();
		String s = sc.readLine();
		st += st;
		Pattern p = Pattern.compile(s);
		Matcher matcher = p.matcher(st);
		if(matcher.find()){
			sb.append("Yes\n");
		}else{
			sb.append("No\n");
		}
		System.out.print(sb);
	} main {
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String st = sc.readLine();
		String s = sc.readLine();
		st += st;
		Pattern p = Pattern.compile(s);
		Matcher matcher = p.matcher(st);
		if(matcher.find()){
			sb.append("Yes\n");
		}else{
			sb.append("No\n");
		}
		System.out.print(sb);
	} BufferedReader sc = new BufferedReader(new InputStreamReader(System.in)); sc new BufferedReader(new InputStreamReader(System.in)) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String st = sc.readLine(); st sc.readLine() sc.readLine sc String s = sc.readLine(); s sc.readLine() sc.readLine sc st += st st st Pattern p = Pattern.compile(s); p Pattern.compile(s) Pattern.compile Pattern s Matcher matcher = p.matcher(st); matcher p.matcher(st) p.matcher p st if(matcher.find()){
			sb.append("Yes\n");
		}else{
			sb.append("No\n");
		} matcher.find() matcher.find matcher {
			sb.append("Yes\n");
		} sb.append("Yes\n") sb.append sb "Yes\n" {
			sb.append("No\n");
		} sb.append("No\n") sb.append sb "No\n" System.out.print(sb) System.out.print System.out System System.out sb String[] args args public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String st = sc.readLine();
		String s = sc.readLine();
		st += st;
		Pattern p = Pattern.compile(s);
		Matcher matcher = p.matcher(st);
		if(matcher.find()){
			sb.append("Yes\n");
		}else{
			sb.append("No\n");
		}
		System.out.print(sb);
	}
} public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String st = sc.readLine();
		String s = sc.readLine();
		st += st;
		Pattern p = Pattern.compile(s);
		Matcher matcher = p.matcher(st);
		if(matcher.find()){
			sb.append("Yes\n");
		}else{
			sb.append("No\n");
		}
		System.out.print(sb);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.StringBuilder;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String st = sc.readLine();
		String s = sc.readLine();
		st += st;
		Pattern p = Pattern.compile(s);
		Matcher matcher = p.matcher(st);
		if(matcher.find()){
			sb.append("Yes\n");
		}else{
			sb.append("No\n");
		}
		System.out.print(sb);
	}
}