import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		String input_line = input.readLine();

		//?????????????????°
		String half_Ring=input_line;

		//??????????????????????????????????????¨????????????
		StringBuilder sb = new StringBuilder();

		//?????????????????????????????????
		sb.append(half_Ring);

		//??????
		sb.append(half_Ring);

		//?????????????????¨???????????????????????????????????????????????????
		String str = new String(sb);

		//????????????????????????????´¢???????????????
		String Word=input.readLine();

		//????´¢???????????????????????°Yes??????
		if(str.contains(Word)){

			System.out.println("Yes");

		}else{

			System.out.println("No");
		}
		
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		String input_line = input.readLine();

		//?????????????????°
		String half_Ring=input_line;

		//??????????????????????????????????????¨????????????
		StringBuilder sb = new StringBuilder();

		//?????????????????????????????????
		sb.append(half_Ring);

		//??????
		sb.append(half_Ring);

		//?????????????????¨???????????????????????????????????????????????????
		String str = new String(sb);

		//????????????????????????????´¢???????????????
		String Word=input.readLine();

		//????´¢???????????????????????°Yes??????
		if(str.contains(Word)){

			System.out.println("Yes");

		}else{

			System.out.println("No");
		}
		
	}

} Main public static void main(String[] args) throws IOException {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		String input_line = input.readLine();

		//?????????????????°
		String half_Ring=input_line;

		//??????????????????????????????????????¨????????????
		StringBuilder sb = new StringBuilder();

		//?????????????????????????????????
		sb.append(half_Ring);

		//??????
		sb.append(half_Ring);

		//?????????????????¨???????????????????????????????????????????????????
		String str = new String(sb);

		//????????????????????????????´¢???????????????
		String Word=input.readLine();

		//????´¢???????????????????????°Yes??????
		if(str.contains(Word)){

			System.out.println("Yes");

		}else{

			System.out.println("No");
		}
		
	} main {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		String input_line = input.readLine();

		//?????????????????°
		String half_Ring=input_line;

		//??????????????????????????????????????¨????????????
		StringBuilder sb = new StringBuilder();

		//?????????????????????????????????
		sb.append(half_Ring);

		//??????
		sb.append(half_Ring);

		//?????????????????¨???????????????????????????????????????????????????
		String str = new String(sb);

		//????????????????????????????´¢???????????????
		String Word=input.readLine();

		//????´¢???????????????????????°Yes??????
		if(str.contains(Word)){

			System.out.println("Yes");

		}else{

			System.out.println("No");
		}
		
	} BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) String input_line = input.readLine(); input_line input.readLine() input.readLine input String half_Ring=input_line; half_Ring input_line StringBuilder sb = new StringBuilder(); sb new StringBuilder() sb.append(half_Ring) sb.append sb half_Ring sb.append(half_Ring) sb.append sb half_Ring String str = new String(sb); str new String(sb) String Word=input.readLine(); Word input.readLine() input.readLine input if(str.contains(Word)){

			System.out.println("Yes");

		}else{

			System.out.println("No");
		} str.contains(Word) str.contains str Word {

			System.out.println("Yes");

		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {

			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		String input_line = input.readLine();

		//?????????????????°
		String half_Ring=input_line;

		//??????????????????????????????????????¨????????????
		StringBuilder sb = new StringBuilder();

		//?????????????????????????????????
		sb.append(half_Ring);

		//??????
		sb.append(half_Ring);

		//?????????????????¨???????????????????????????????????????????????????
		String str = new String(sb);

		//????????????????????????????´¢???????????????
		String Word=input.readLine();

		//????´¢???????????????????????°Yes??????
		if(str.contains(Word)){

			System.out.println("Yes");

		}else{

			System.out.println("No");
		}
		
	}

} public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		String input_line = input.readLine();

		//?????????????????°
		String half_Ring=input_line;

		//??????????????????????????????????????¨????????????
		StringBuilder sb = new StringBuilder();

		//?????????????????????????????????
		sb.append(half_Ring);

		//??????
		sb.append(half_Ring);

		//?????????????????¨???????????????????????????????????????????????????
		String str = new String(sb);

		//????????????????????????????´¢???????????????
		String Word=input.readLine();

		//????´¢???????????????????????°Yes??????
		if(str.contains(Word)){

			System.out.println("Yes");

		}else{

			System.out.println("No");
		}
		
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		String input_line = input.readLine();

		//?????????????????°
		String half_Ring=input_line;

		//??????????????????????????????????????¨????????????
		StringBuilder sb = new StringBuilder();

		//?????????????????????????????????
		sb.append(half_Ring);

		//??????
		sb.append(half_Ring);

		//?????????????????¨???????????????????????????????????????????????????
		String str = new String(sb);

		//????????????????????????????´¢???????????????
		String Word=input.readLine();

		//????´¢???????????????????????°Yes??????
		if(str.contains(Word)){

			System.out.println("Yes");

		}else{

			System.out.println("No");
		}
		
	}

}