You are given three strings aa , bb and cc of the same length nn . The strings consist of lowercase English letters only. The ii -th letter of aa is aiai , the ii -th letter of bb is bibi , the ii -th letter of cc is cici .

For every ii (1≤i≤n1≤i≤n ) you must swap (i.e. exchange) cici with either aiai or bibi . So in total you'll perform exactly nn swap operations, each of them either ci↔aici↔ai or ci↔bici↔bi (ii iterates over all integers between 11 and nn , inclusive).

For example, if aa is "code", bb is "true", and cc is "help", you can make cc equal to "crue" taking the 11 -st and the 44 -th letters from aa and the others from bb . In this way aa becomes "hodp" and bb becomes "tele".

Is it possible that after these swaps the string aa becomes exactly the same as the string bb ?

Input

The input consists of multiple test cases. The first line contains a single integer tt (1≤t≤1001≤t≤100 )  — the number of test cases. The description of the test cases follows.

The first line of each test case contains a string of lowercase English letters aa .

The second line of each test case contains a string of lowercase English letters bb .

The third line of each test case contains a string of lowercase English letters cc .

It is guaranteed that in each test case these three strings are non-empty and have the same length, which is not exceeding 100100 .

Output

Print tt lines with answers for all test cases. For each test case:

If it is possible to make string aa equal to string bb print "YES" (without quotes), otherwise print "NO" (without quotes).

You can print either lowercase or uppercase letters in the answers.

Example

Input
4
aaa
bbb
ccc
abc
bca
bca
aabb
bbaa
baba
imi
mii
iim
Output
NO
YES
YES
NO
水题。最终目的是要求a和b一样,这样的话,因为ai或者bi其中之一可以与ci交换,所以如果ai==ci,那么拿bi与ci交换,之后可以得到ai==bi;同理bi==ci,可以拿ai与ci交换,遍历一遍看看能不能满足即可。
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
char a[];
char b[];
char c[];
scanf("%s",a);
scanf("%s",b);
scanf("%s",c);
int i;
int cnt=;
for(i=;i<strlen(a);i++)
{
if(a[i]==c[i]||b[i]==c[i])cnt++;
}
if(cnt==strlen(a))
{
cout<<"YES"<<endl;
continue;
}
cout<<"NO"<<endl;
}
}

Codeforces Round #619 (Div. 2) A. Three Strings的更多相关文章

  1. Codeforces Round #313 (Div. 1) B. Equivalent Strings

    Equivalent Strings Problem's Link: http://codeforces.com/contest/559/problem/B Mean: 给定两个等长串s1,s2,判断 ...

  2. Codeforces Round #313 (Div. 2) D. Equivalent Strings

    D. Equivalent Strings Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/ ...

  3. Codeforces Round #313 (Div. 1) B. Equivalent Strings DFS暴力

    B. Equivalent Strings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559 ...

  4. Codeforces Round #302 (Div. 1) C. Remembering Strings DP

    C. Remembering Strings Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...

  5. Codeforces Round #302 (Div. 1) C - Remembering Strings 状压dp

    C - Remembering Strings 思路:最关键的一点是字符的个数比串的个数多. 然后就能状压啦. #include<bits/stdc++.h> #define LL lon ...

  6. (原创)Codeforces Round #550 (Div. 3) A Diverse Strings

    A. Diverse Strings time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  7. Codeforces Round #313 (Div. 2) 560D Equivalent Strings(dos)

    D. Equivalent Strings time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  8. Codeforces Round #619 (Div. 2) Ayoub's function

    Ayoub thinks that he is a very smart person, so he created a function f(s)f(s) , where ss is a binar ...

  9. Codeforces Round #619 (Div. 2)

    A. Three Strings 题意:给三个长度相同的非空字符串abc,依次将c中的每个字符和a或者b中对应位置的字符进行交换,交换必须进行,问能否使得ab相同. 思路:对于每一个位置,如果三个字符 ...

随机推荐

  1. pycharm2019.3安装以及激活

    最近很多的pycharm激活过期的,小伙伴们问我pycharm要怎么激活?这里就分享一下pycharm最新版本的安装以及激活吧!!! 首先先去官网(https://www.jetbrains.com/ ...

  2. C++ - cpprestsdk

    Windows 安装方法: CMake 1.32+,生成过程会将 vcpkg 下载好,配置到系统环境变量,然后用 vcpkg 安装依赖库(github 上有列出需要的依赖库). Github 上的示例 ...

  3. 使用js处理后台返回的Date类型的数据

    从后台返回的日期类型的数据,如果直接在前端进行显示的话,显示的就是一个从 1970-01-01 00:00:00到现在所经过的毫秒数,而在大多数业务中都不可能显示这个毫秒数,大多数都是显示一个正常的日 ...

  4. Flask 教程 第二十章:加点JavaScript魔法

    本文翻译自The Flask Mega-Tutorial Part XX: Some JavaScript Magic 这是Flask Mega-Tutorial系列的第二十部分,我将添加一个功能,当 ...

  5. linux centos7分区

    哈喽! 我今天来分享一下Linux的分区,本次我使用的是LinuxCentos7版本为例,使用虚拟机,命令是fdisk Linux分区有4个主分区及扩展分区,逻辑分区. 首先给虚拟机添加8G硬盘(硬盘 ...

  6. 8.10-Day2T1最小值

    题目大意 裴蜀定理   题解 很简单... 我这个蒟蒻都猜的出来... 就求所有数的最大公约数 但注意 要加绝对值 因为gcd里面不能传负数   #include<cstdio> #inc ...

  7. centos长ping输出日志的脚本

    为监控某服务器的网络情况,制作一个sh脚本,记录ping的长过程,并输出日志以备观察. 1.脚本如下 cat /home/summer/ping100.sh #!/bin/sh ping 172.16 ...

  8. 第十一篇 深入Python的dict和set(二)

  9. 1.java-谈谈接口

    1.面向接口给程序带来的便利和灵活性 List li = new ArrayLIst(); 为什么不写成 ArrayList li = new ArrayLIst(); 2.接口就相当于一些类的规范, ...

  10. 整体单改,单局部改,整体局部改,ListSerializer类

    复习 """ 1.ModelSerializer序列化类 models.py class BaseModel(models.Model): is_delete = mod ...