import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    //String blank = sc.nextLine();
    String t = sc.nextLine();
    String s1 = s;
    String s2 = null;
    boolean flag = false;

    for(int i = 0; i < s.length(); i++){
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    }

    if(flag == true){System.out.println("Yes");}
    else{System.out.println("No");}

  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    //String blank = sc.nextLine();
    String t = sc.nextLine();
    String s1 = s;
    String s2 = null;
    boolean flag = false;

    for(int i = 0; i < s.length(); i++){
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    }

    if(flag == true){System.out.println("Yes");}
    else{System.out.println("No");}

  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    //String blank = sc.nextLine();
    String t = sc.nextLine();
    String s1 = s;
    String s2 = null;
    boolean flag = false;

    for(int i = 0; i < s.length(); i++){
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    }

    if(flag == true){System.out.println("Yes");}
    else{System.out.println("No");}

  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    //String blank = sc.nextLine();
    String t = sc.nextLine();
    String s1 = s;
    String s2 = null;
    boolean flag = false;

    for(int i = 0; i < s.length(); i++){
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    }

    if(flag == true){System.out.println("Yes");}
    else{System.out.println("No");}

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String t = sc.nextLine(); t sc.nextLine() sc.nextLine sc String s1 = s; s1 s String s2 = null; s2 null boolean flag = false; flag false for(int i = 0; i < s.length(); i++){
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    } {
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    } s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1) s2 s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1) s1.charAt(s1.length()-1) s1.charAt s1 s1.length()-1 s1.length() s1.length s1 1 s1.substring(0, s1.length()-1) s1.substring s1 0 s1.length()-1 s1.length() s1.length s1 1 if(s2.equals(t)){flag = true; break;} s2.equals(t) s2.equals s2 t {flag = true; break;} flag = true flag true break; s1 = s2 s1 s2 s2 = null s2 null if(flag == true){System.out.println("Yes");}
    else{System.out.println("No");} flag == true flag true {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){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    //String blank = sc.nextLine();
    String t = sc.nextLine();
    String s1 = s;
    String s2 = null;
    boolean flag = false;

    for(int i = 0; i < s.length(); i++){
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    }

    if(flag == true){System.out.println("Yes");}
    else{System.out.println("No");}

  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    //String blank = sc.nextLine();
    String t = sc.nextLine();
    String s1 = s;
    String s2 = null;
    boolean flag = false;

    for(int i = 0; i < s.length(); i++){
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    }

    if(flag == true){System.out.println("Yes");}
    else{System.out.println("No");}

  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    //String blank = sc.nextLine();
    String t = sc.nextLine();
    String s1 = s;
    String s2 = null;
    boolean flag = false;

    for(int i = 0; i < s.length(); i++){
      s2 = s1.charAt(s1.length()-1) + s1.substring(0, s1.length()-1);
      if(s2.equals(t)){flag = true; break;}
      s1 = s2;
      s2 = null;
    }

    if(flag == true){System.out.println("Yes");}
    else{System.out.println("No");}

  }
}
