include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED] // 添加这一行
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
string xipai(string a,string b)
{
string temp;
for (int i = 0; i < a.size(); i++)
{
temp += b[i];
temp += a[i];
}
return temp;
}
int main()
{
int t;
cin >> t;
int i = 1;
while (t–)
{
int c;
cin >> c;
string s1, s2, s12;
cin >> s1 >> s2 >> s12;
set[HTML_REMOVED] ss;
int count = 0;
while (1)
{
ss.insert(s1 + s2);
string temp = xipai(s1, s2);
s1 = temp.substr(0, c);
s2= temp.substr( c,c);
count++;
if (s1 + s2 == s12)
{
cout << i << " " << count << endl;
break;
}
if (ss.count(s1 + s2) == 1)
{
cout << i << " -1" << endl;
break;
}
}
i++;
}
return 0;
}