import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.util.*;

public class Main{
  public static void main(String args[]) {
    Scanner in  = new Scanner(System.in);
    //行の読み込み
    String ring = in.nextLine();
    ring += ring;
    String str  = in.nextLine();
    if(ring.contains(str)){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}
 import java.awt.*; awt.* java import java.awt.geom.*; geom.* java.awt import java.io.*; io.* java import java.util.*; util.* java public class Main{
  public static void main(String args[]) {
    Scanner in  = new Scanner(System.in);
    //行の読み込み
    String ring = in.nextLine();
    ring += ring;
    String str  = in.nextLine();
    if(ring.contains(str)){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} Main public static void main(String args[]) {
    Scanner in  = new Scanner(System.in);
    //行の読み込み
    String ring = in.nextLine();
    ring += ring;
    String str  = in.nextLine();
    if(ring.contains(str)){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  } main {
    Scanner in  = new Scanner(System.in);
    //行の読み込み
    String ring = in.nextLine();
    ring += ring;
    String str  = in.nextLine();
    if(ring.contains(str)){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  } Scanner in  = new Scanner(System.in); in new Scanner(System.in) String ring = in.nextLine(); ring in.nextLine() in.nextLine in ring += ring ring ring String str  = in.nextLine(); str in.nextLine() in.nextLine in if(ring.contains(str)){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    } ring.contains(str) ring.contains ring str {
      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 in  = new Scanner(System.in);
    //行の読み込み
    String ring = in.nextLine();
    ring += ring;
    String str  = in.nextLine();
    if(ring.contains(str)){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} public class Main{
  public static void main(String args[]) {
    Scanner in  = new Scanner(System.in);
    //行の読み込み
    String ring = in.nextLine();
    ring += ring;
    String str  = in.nextLine();
    if(ring.contains(str)){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} Main
import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.util.*;

public class Main{
  public static void main(String args[]) {
    Scanner in  = new Scanner(System.in);
    //行の読み込み
    String ring = in.nextLine();
    ring += ring;
    String str  = in.nextLine();
    if(ring.contains(str)){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

