import java.util.*;
 
public class Main {
  public static void main(String[] args) {
 	  Scanner sc = new Scanner(System.in);
 
    String s = sc.next();
    String t = sc.next();
 
    boolean answer = false;
 
    for(int i = 0; i < s.length(); i++){
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    }
 
    System.out.println(answer? "Yes" : "No"); 
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
 	  Scanner sc = new Scanner(System.in);
 
    String s = sc.next();
    String t = sc.next();
 
    boolean answer = false;
 
    for(int i = 0; i < s.length(); i++){
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    }
 
    System.out.println(answer? "Yes" : "No"); 
  }
} Main public static void main(String[] args) {
 	  Scanner sc = new Scanner(System.in);
 
    String s = sc.next();
    String t = sc.next();
 
    boolean answer = false;
 
    for(int i = 0; i < s.length(); i++){
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    }
 
    System.out.println(answer? "Yes" : "No"); 
  } main {
 	  Scanner sc = new Scanner(System.in);
 
    String s = sc.next();
    String t = sc.next();
 
    boolean answer = false;
 
    for(int i = 0; i < s.length(); i++){
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    }
 
    System.out.println(answer? "Yes" : "No"); 
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc boolean answer = false; answer false for(int i = 0; i < s.length(); i++){
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    } {
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    } boolean checker = true; checker true for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      } int j = 0; int j = 0; j 0 j < s.length() j s.length() s.length s j++ j++ j {
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      } {
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      } if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        } s.charAt(j) != t.charAt((j+i)%s.length()) s.charAt(j) s.charAt s j t.charAt((j+i)%s.length()) t.charAt t (j+i)%s.length() (j+i) j i s.length() s.length s {
          checker = false;
        } checker = false checker false if(checker){
        answer = true;
        break;
      } checker {
        answer = true;
        break;
      } answer = true answer true break; System.out.println(answer? "Yes" : "No") System.out.println System.out System System.out answer? "Yes" : "No" answer "Yes" "No" String[] args args public class Main {
  public static void main(String[] args) {
 	  Scanner sc = new Scanner(System.in);
 
    String s = sc.next();
    String t = sc.next();
 
    boolean answer = false;
 
    for(int i = 0; i < s.length(); i++){
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    }
 
    System.out.println(answer? "Yes" : "No"); 
  }
} public class Main {
  public static void main(String[] args) {
 	  Scanner sc = new Scanner(System.in);
 
    String s = sc.next();
    String t = sc.next();
 
    boolean answer = false;
 
    for(int i = 0; i < s.length(); i++){
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    }
 
    System.out.println(answer? "Yes" : "No"); 
  }
} Main
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
 	  Scanner sc = new Scanner(System.in);
 
    String s = sc.next();
    String t = sc.next();
 
    boolean answer = false;
 
    for(int i = 0; i < s.length(); i++){
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    }
 
    System.out.println(answer? "Yes" : "No"); 
  }
}