You are given two strings and of length consisting of lowercase English letters.
The strings are considered circular, meaning the character immediately following is .
In a single operation, you can choose an index () and perform the following changes simultaneously:
Find the minimum number of operations required to transform string into string . If it is impossible to do so, output -1.
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer () — the length of the strings.
The second line of each test case contains the string of length .
The third line of each test case contains the string of length .
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output a single integer — the minimum number of operations required to transform into , or if it is impossible.
For "abc" and "bca", Fady can match the password in operations: