import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s=sc.next(),t=sc.next();
    s+=s;
    System.out.println(s.contains(t)?"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(),t=sc.next();
    s+=s;
    System.out.println(s.contains(t)?"Yes":"No");
      }
} Main public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s=sc.next(),t=sc.next();
    s+=s;
    System.out.println(s.contains(t)?"Yes":"No");
      } main {
    Scanner sc=new Scanner(System.in);
    String s=sc.next(),t=sc.next();
    s+=s;
    System.out.println(s.contains(t)?"Yes":"No");
      } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String s=sc.next() s sc.next() sc.next sc t=sc.next(); t sc.next() sc.next sc s+=s s s System.out.println(s.contains(t)?"Yes":"No") System.out.println System.out System System.out s.contains(t)?"Yes":"No" s.contains(t) s.contains s t "Yes" "No" String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s=sc.next(),t=sc.next();
    s+=s;
    System.out.println(s.contains(t)?"Yes":"No");
      }
} public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s=sc.next(),t=sc.next();
    s+=s;
    System.out.println(s.contains(t)?"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(),t=sc.next();
    s+=s;
    System.out.println(s.contains(t)?"Yes":"No");
      }
}