import java.util.Scanner;
import java.util.Arrays;

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

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t=sc.next();
    t=t+t;
    System.out.println(t.contains(s)?"Yes":"No");
  }
}