function main(input){
	var data = input.split('\n');
	for (var i = 0, l = data[1].length; i < l; i++) {
		if (data[0] == data[1]) break;
		x = data[0].split('');
		x.push(x.shift());
		data[0] = x.join('');
	}
	console.log(['No','Yes'][Number(data[0] == data[1])]);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));