import java.io.*;

public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder s = new StringBuilder(br.readLine());
    String t = br.readLine();
    
    for(int i = 0; i < s.length(); i++) {
      char c = s.charAt(0);
      s.deleteCharAt(0);
      s.append(c);
      
      if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }
} import java.io.*; io.* java public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder s = new StringBuilder(br.readLine());
    String t = br.readLine();
    
    for(int i = 0; i < s.length(); i++) {
      char c = s.charAt(0);
      s.deleteCharAt(0);
      s.append(c);
      
      if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }
} Main public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder s = new StringBuilder(br.readLine());
    String t = br.readLine();
    
    for(int i = 0; i < s.length(); i++) {
      char c = s.charAt(0);
      s.deleteCharAt(0);
      s.append(c);
      
      if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  } main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder s = new StringBuilder(br.readLine());
    String t = br.readLine();
    
    for(int i = 0; i < s.length(); i++) {
      char c = s.charAt(0);
      s.deleteCharAt(0);
      s.append(c);
      
      if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringBuilder s = new StringBuilder(br.readLine()); s new StringBuilder(br.readLine()) String t = br.readLine(); t br.readLine() br.readLine br for(int i = 0; i < s.length(); i++) {
      char c = s.charAt(0);
      s.deleteCharAt(0);
      s.append(c);
      
      if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      }
    } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
      char c = s.charAt(0);
      s.deleteCharAt(0);
      s.append(c);
      
      if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      }
    } {
      char c = s.charAt(0);
      s.deleteCharAt(0);
      s.append(c);
      
      if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      }
    } char c = s.charAt(0); c s.charAt(0) s.charAt s 0 s.deleteCharAt(0) s.deleteCharAt s 0 s.append(c) s.append s c if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      } t.equals(s.toString()) t.equals t s.toString() s.toString s {
        System.out.println("Yes");
        return;
      } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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 Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder s = new StringBuilder(br.readLine());
    String t = br.readLine();
    
    for(int i = 0; i < s.length(); i++) {
      char c = s.charAt(0);
      s.deleteCharAt(0);
      s.append(c);
      
      if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }
} public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder s = new StringBuilder(br.readLine());
    String t = br.readLine();
    
    for(int i = 0; i < s.length(); i++) {
      char c = s.charAt(0);
      s.deleteCharAt(0);
      s.append(c);
      
      if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }
} Main
import java.io.*;

public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder s = new StringBuilder(br.readLine());
    String t = br.readLine();
    
    for(int i = 0; i < s.length(); i++) {
      char c = s.charAt(0);
      s.deleteCharAt(0);
      s.append(c);
      
      if(t.equals(s.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }
}
