import java.io.*;
public class Main
{
public static void main(String args[])throws IOException
{
int t;
String str1, str2;
InputStreamReader br = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(br);
t=Integer.parseInt(in.readLine());
String x[]= new String[t];
int i,k,c,l,j=0,T=t;
while(t>0)
{ k=0;l=0;c=0;
str1=in.readLine();
str2=in.readLine();
for(i=0;i<3;i++)
{
char ch1 = str1.charAt(i);
char ch2 = str2.charAt(i);
if((ch1=='b')||(ch2=='b'))
{c+=1;}
if((ch1=='o')||(ch2=='o'))
{k+=1;}
if(((ch1=='o')&&(ch2=='b'))||((ch1=='b')&&(ch2=='o')))
{l+=1;}
}
if((c>=2)&&(k>=1))
{
if((c==2)&&(k==1)&&(l==1))
{x[j]="No";}
else if((c==2)&&(k==2)&&(l==2))
{x[j]="No";}
else
{x[j]="Yes";}
j++;
}
else
{x[j]="No";
j++;
}
t--;
}
for(i=0;i<T;i++)
{
System.out.println(x[i]);
}
}
}
my code is right but still wrong answer is given