import java.util.*;
import java.io.*;

class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String s = br.readLine();	//?????????????????????????????????
        String p = br.readLine();	//?????????????????????????????????
        sb.append(s);				//sb?????????????????¨??????????????????????????¨??????????????????
        sb.append(s);
        if(sb.indexOf(p) != -1){
        	//??????????????????????±??????????????????????????????????????????????indexOf??§??????
        	//????±?????????????????????£?????´?????????-1??????????????§!=?????¶?????????
        	System.out.println("Yes");
        	//-1??\????????£??????Yes??????????????????
        }else{
        	System.out.println("No");
        	//-1?????£??????No??????????????????
        }
     }
} import java.util.*; util.* java import java.io.*; io.* java class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String s = br.readLine();	//?????????????????????????????????
        String p = br.readLine();	//?????????????????????????????????
        sb.append(s);				//sb?????????????????¨??????????????????????????¨??????????????????
        sb.append(s);
        if(sb.indexOf(p) != -1){
        	//??????????????????????±??????????????????????????????????????????????indexOf??§??????
        	//????±?????????????????????£?????´?????????-1??????????????§!=?????¶?????????
        	System.out.println("Yes");
        	//-1??\????????£??????Yes??????????????????
        }else{
        	System.out.println("No");
        	//-1?????£??????No??????????????????
        }
     }
} Main public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String s = br.readLine();	//?????????????????????????????????
        String p = br.readLine();	//?????????????????????????????????
        sb.append(s);				//sb?????????????????¨??????????????????????????¨??????????????????
        sb.append(s);
        if(sb.indexOf(p) != -1){
        	//??????????????????????±??????????????????????????????????????????????indexOf??§??????
        	//????±?????????????????????£?????´?????????-1??????????????§!=?????¶?????????
        	System.out.println("Yes");
        	//-1??\????????£??????Yes??????????????????
        }else{
        	System.out.println("No");
        	//-1?????£??????No??????????????????
        }
     } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String s = br.readLine();	//?????????????????????????????????
        String p = br.readLine();	//?????????????????????????????????
        sb.append(s);				//sb?????????????????¨??????????????????????????¨??????????????????
        sb.append(s);
        if(sb.indexOf(p) != -1){
        	//??????????????????????±??????????????????????????????????????????????indexOf??§??????
        	//????±?????????????????????£?????´?????????-1??????????????§!=?????¶?????????
        	System.out.println("Yes");
        	//-1??\????????£??????Yes??????????????????
        }else{
        	System.out.println("No");
        	//-1?????£??????No??????????????????
        }
     } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String s = br.readLine(); s br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br sb.append(s) sb.append sb s sb.append(s) sb.append sb s if(sb.indexOf(p) != -1){
        	//??????????????????????±??????????????????????????????????????????????indexOf??§??????
        	//????±?????????????????????£?????´?????????-1??????????????§!=?????¶?????????
        	System.out.println("Yes");
        	//-1??\????????£??????Yes??????????????????
        }else{
        	System.out.println("No");
        	//-1?????£??????No??????????????????
        } sb.indexOf(p) != -1 sb.indexOf(p) sb.indexOf sb p -1 1 {
        	//??????????????????????±??????????????????????????????????????????????indexOf??§??????
        	//????±?????????????????????£?????´?????????-1??????????????§!=?????¶?????????
        	System.out.println("Yes");
        	//-1??\????????£??????Yes??????????????????
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
        	System.out.println("No");
        	//-1?????£??????No??????????????????
        } System.out.println("No") System.out.println System.out System System.out "No" String args[] args
import java.util.*;
import java.io.*;

class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String s = br.readLine();	//?????????????????????????????????
        String p = br.readLine();	//?????????????????????????????????
        sb.append(s);				//sb?????????????????¨??????????????????????????¨??????????????????
        sb.append(s);
        if(sb.indexOf(p) != -1){
        	//??????????????????????±??????????????????????????????????????????????indexOf??§??????
        	//????±?????????????????????£?????´?????????-1??????????????§!=?????¶?????????
        	System.out.println("Yes");
        	//-1??\????????£??????Yes??????????????????
        }else{
        	System.out.println("No");
        	//-1?????£??????No??????????????????
        }
     }
}