logo AlgoBeat OnlineJudge
登录 注册

#214285. [ICPC 2024 Hangzhou R] AUS

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Pigeland University will host the 2224 Animal Collegiate Programming Contest (ACPC 2224). Unlike previous years, where teams from the host institution were marked as unofficial, Pigeland will send official teams to compete in the contest with three workstations for each team. Nevertheless, Pig-head, the coach of Pigeland University, remains uncertain about his teams' chances of securing gold medals. As a result, he decides to acquire the contest problems in advance from the AUS problem-setting group, using the excuse of needing to upload data to the online judge.

To prevent cheating, AUS attempts to encrypt the problems using a special cipher. Specifically, problems are represented by strings consisting of lowercase English letters. AUS wants to design a cipher function that maps lowercase English letters to lowercase English letters. For a problem , the encrypted version of the problem is another string given by . For example, when and , , , the encrypted version is .

As a member of AUS, your task is to design the cipher function . The leader of AUS believes that the function is if and only if there exists at least one problem that can be encrypted into the same encrypted version as another, while not all problems produce the same encrypted output. To validate this, he will give you three problems , , and , and you need to find a cipher function such that and . Since AUS has several experienced members, your task is simply to determine whether such a cipher function exists.

输入格式

There are multiple test cases. The first line contains an integer () indicating the number of test cases. For each test case:

The first line contains a string () consisting of only lowercase English letters.

The second line contains a string () consisting of only lowercase English letters.

The third line contains a string () consisting of only lowercase English letters.

It is guaranteed that the sum of of all test cases does not exceed .

输出格式

For each test case, if such cipher function exists, output in one line. Otherwise, output instead.

样例

样例输入 1

4
abab
cdcd
abce
abab
cdcd
abcd
abab
cdcd
abc
x
yz
def

样例输出 1

YES
NO
YES
NO

数据范围与提示

For the first and third sample test cases, one valid cipher function can be and .