"use strict"
function main(input) {

	let tmp = null
	let boo = false
	//let i = 0

	input = input.split('\n')
	input[0] = input[0].split('')
	input[1] = input[1].split('')

	for(let i=0;i<input[0].length;i++)
	//while(boo == false || i < input[0].length )
	{
		tmp = input[0].pop()
		input[0].unshift(tmp)
		if(input[0].join('')==input[1].join(''))
		{
			boo = true
			console.log('Yes')
			break
		}else{

		}
		//i++

	}
	if(!boo) console.log('No')

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
