import java.util.*;

class Main{
    public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);

        String text1 = sc.next();

        String text2 = sc.next();

        String[] ring = text1.split("", 0);

        String[] belt = text2.split("", 0);

        boolean check = false;
        for(int i = 0; i < ring.length; i++){
            if(belt[0].equals(ring[i])){
                int ring_check = i + 1;
                int count = 1;
                for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                }
                if(count == belt.length){
                    check = true;
                }
            }
        }
        if(check){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.*; util.* java class Main{
    public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);

        String text1 = sc.next();

        String text2 = sc.next();

        String[] ring = text1.split("", 0);

        String[] belt = text2.split("", 0);

        boolean check = false;
        for(int i = 0; i < ring.length; i++){
            if(belt[0].equals(ring[i])){
                int ring_check = i + 1;
                int count = 1;
                for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                }
                if(count == belt.length){
                    check = true;
                }
            }
        }
        if(check){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);

        String text1 = sc.next();

        String text2 = sc.next();

        String[] ring = text1.split("", 0);

        String[] belt = text2.split("", 0);

        boolean check = false;
        for(int i = 0; i < ring.length; i++){
            if(belt[0].equals(ring[i])){
                int ring_check = i + 1;
                int count = 1;
                for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                }
                if(count == belt.length){
                    check = true;
                }
            }
        }
        if(check){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        
        Scanner sc = new Scanner(System.in);

        String text1 = sc.next();

        String text2 = sc.next();

        String[] ring = text1.split("", 0);

        String[] belt = text2.split("", 0);

        boolean check = false;
        for(int i = 0; i < ring.length; i++){
            if(belt[0].equals(ring[i])){
                int ring_check = i + 1;
                int count = 1;
                for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                }
                if(count == belt.length){
                    check = true;
                }
            }
        }
        if(check){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String text1 = sc.next(); text1 sc.next() sc.next sc String text2 = sc.next(); text2 sc.next() sc.next sc String[] ring = text1.split("", 0); ring text1.split("", 0) text1.split text1 "" 0 String[] belt = text2.split("", 0); belt text2.split("", 0) text2.split text2 "" 0 boolean check = false; check false for(int i = 0; i < ring.length; i++){
            if(belt[0].equals(ring[i])){
                int ring_check = i + 1;
                int count = 1;
                for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                }
                if(count == belt.length){
                    check = true;
                }
            }
        } int i = 0; int i = 0; i 0 i < ring.length i ring.length ring ring.length i++ i++ i {
            if(belt[0].equals(ring[i])){
                int ring_check = i + 1;
                int count = 1;
                for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                }
                if(count == belt.length){
                    check = true;
                }
            }
        } {
            if(belt[0].equals(ring[i])){
                int ring_check = i + 1;
                int count = 1;
                for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                }
                if(count == belt.length){
                    check = true;
                }
            }
        } if(belt[0].equals(ring[i])){
                int ring_check = i + 1;
                int count = 1;
                for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                }
                if(count == belt.length){
                    check = true;
                }
            } belt[0].equals(ring[i]) belt[0].equals belt[0] belt 0 ring[i] ring i {
                int ring_check = i + 1;
                int count = 1;
                for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                }
                if(count == belt.length){
                    check = true;
                }
            } int ring_check = i + 1; ring_check i + 1 i 1 int count = 1; count 1 for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                } int j = 1; int j = 1; j 1 j < belt.length j belt.length belt belt.length j++ j++ j {
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                } {
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                } if(ring_check >= ring.length){
                        ring_check = 0;
                    } ring_check >= ring.length ring_check ring.length ring ring.length {
                        ring_check = 0;
                    } ring_check = 0 ring_check 0 if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    } belt[j].equals(ring[ring_check]) belt[j].equals belt[j] belt j ring[ring_check] ring ring_check {
                        count++;
                        ring_check++;
                    } count++ count ring_check++ ring_check {
                        break;
                    } break; if(count == belt.length){
                    check = true;
                } count == belt.length count belt.length belt belt.length {
                    check = true;
                } check = true check true if(check){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } check {
            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
import java.util.*;

class Main{
    public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);

        String text1 = sc.next();

        String text2 = sc.next();

        String[] ring = text1.split("", 0);

        String[] belt = text2.split("", 0);

        boolean check = false;
        for(int i = 0; i < ring.length; i++){
            if(belt[0].equals(ring[i])){
                int ring_check = i + 1;
                int count = 1;
                for(int j = 1; j < belt.length; j++){
                    if(ring_check >= ring.length){
                        ring_check = 0;
                    }
                    if(belt[j].equals(ring[ring_check])){
                        count++;
                        ring_check++;
                    }else{
                        break;
                    }
                }
                if(count == belt.length){
                    check = true;
                }
            }
        }
        if(check){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}
