CF1922A.Tricky Template

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Tricky Template

You are given an integer nn and three strings a,b,ca, b, c, each consisting of nn lowercase Latin letters.

Let a template be a string tt consisting of nn lowercase and/or uppercase Latin letters. The string ss matches the template tt if the following conditions hold for all ii from 11 to nn:

  • if the ii-th letter of the template is lowercase, then sis_i must be the same as tit_i;
  • if the ii-th letter of the template is uppercase, then sis_i must be different from the lowercase version of tit_i. For example, if there is a letter 'A' in the template, you cannot use the letter 'a' in the corresponding position of the string.

Accordingly, the string doesn't match the template if the condition doesn't hold for at least one ii.

Determine whether there exists a template tt such that the strings aa and bb match it, while the string cc does not.

Input

The first line contains an integer tt (1t10001 \le t \le 1000) — the number of test cases.

The first line of each test case contains an integer nn (1n201 \le n \le 20) — the length of the given strings.

The next three lines contain the strings a,ba, b and cc. Each string consists of exactly nn lowercase Latin letters.

Output

For each testcase, print "YES" if there exists a template tt such that the strings aa and bb match it, while the string cc does not. Otherwise, print "NO".

Note

In the first test case, you can use the template "C". The first letter of strings aa and bb differ from 'c', so they match the template. The first letter of string cc equals 'c', so it doesn't match.

In the third test case, you can use the template "CODEforces".

Samples

4
1
a
b
c
2
aa
bb
aa
10
mathforces
luckforces
adhoccoder
3
acc
abd
abc
YES
NO
YES
NO

在线编程 IDE

建议全屏模式获得最佳体验