{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eAcesrc loves solving string problems. He defined a relation called $\\textit{k-similarity}$ between two $\\textbf{nonempty}$ strings.\u003cbr\u003e\u003cbr\u003eThe definition of $k$-similarity is shown below:\u003cbr\u003e1. for nonempty string $S$, $S$ and $S$ are $k$-similar;\u003cbr\u003e2. for two nonempty strings $S$ and $T$ with $|S| + |T| \\leq k$, if $S \\circ T$ and $T \\circ S$ are $k$-similar ($\\circ$ denotes string concatenation), then $S$ and $T$ are $k$-similar;\u003cbr\u003e3. if $S$ and $T$ are $k$-similar, then $P \\circ S \\circ Q$ and $P \\circ T \\circ Q$ are $k$-similar, where $P$ and $Q$ are arbitrary (possibly empty) strings;\u003cbr\u003e4. if $S$ and $U$ are $k$-similar, $U$ and $T$ are $k$-similar, then $S$ and $T$ are $k$-similar.\u003cbr\u003e\u003cbr\u003eFor example, $\\texttt{aaa}$ and $\\texttt{aaa}$ are 3-similar according to the the first condition. Hence, $\\texttt{a}$ and $\\texttt{aa}$ are 3-similar according to the second condition. Moreover, $\\texttt{ba}$ and $\\texttt{baa}$, $\\texttt{baa}$ and $\\texttt{baaa}$ are also 3-similar, respectively, according to the third condition. Finally, $\\texttt{ba}$ and $\\texttt{baaa}$ are 3-similar, according to the fourth condition.\u003cbr\u003e\u003cbr\u003eNow, given two strings $A, B$ and an integer $k$, please determine whether $A$ and $B$ are $k$-similar.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input is a single integer $T$ $(1 \\leq T \\leq 5000)$, denoting the number of test cases. Each test case contains three lines, which represent $k$ $(1 \\leq k \\leq 10^6)$, $A$, $B$, respectively. It is guaranteed that $A$ and $B$ contain only lowercase letters \u0027a\u0027-\u0027z\u0027 and the lengths of $A$ and $B$ are between 1 and $2 \\times 10^5$, inclusive. It is further guaranteed that the sum of lengths of $A$ and $B$ in all test cases does not exceed $3 \\times 10^6$."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, display a single line: $\\texttt{yes}$ if $A$ and $B$ are $k$-similar, or $\\texttt{no}$ if they are not."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n3\r\nba\r\nbaa\r\n2\r\naab\r\nab\r\n1\r\nacesrc\r\nacesrc\r\n100\r\nroundgod\r\nzyb\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eyes\r\nno\r\nyes\r\nno\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}