12117 - CS_2018_FINAL-1   

Description

Given two strings s and t, your task is to figure out whether there exists s’ equals to t, where we denote s’ as a left rotation or a right rotation of s.

For example, if s = “abcd”, then s’ can either equals to “abcd”, “bcda””cdab” or dabc.

 

Input

The input consists of multiple test cases. The first line of the input contains one integer T, which is the number of the test cases (1 ≤ T ≤ 100). Each of the following n lines contains a test case formatted as follows.

s t

and t are the two string mentioned above. The length of s and t are the same, and both of them are between 1 and 100, inclusive.

Output

For each test case, print "Yes" if there exists s' equals to t, otherwise print "No".

There is a newline character ‘\n’ at the end of line.

Sample Input  Download

Sample Output  Download

Tags




Discuss