#include <bits/stdc++.h>
using namespace std;
long long MOD(long long, long long);
void doublesetprecision(double, int);
bool isEven(long long);
int gcd(int, int);
int n, m, o, ans, k;
int a[1000000];
void solve() {
  string s, t;
  cin >> s >> t;
  if (s == t) {
    cout << "yes";
    return;
  }
  if (s.size() != t.size()) {
    cout << "no";
    return;
  }
  int hs[26] = {0}, ht[26] = {0};
  for (long long i = 0; i < s.size(); i++) hs[s[i] - 'a']++;
  for (long long i = 0; i < t.size(); i++) ht[t[i] - 'a']++;
  for (long long i = 0; i < 26; i++) {
    if (ht[i] > 0 && hs[i] > 0) {
      cout << "yes";
      return;
    }
  }
  cout << "no";
}
int main() {
  int t = 1;
  scanf("%d", &t);
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
bool isEven(long long n) {
  if (n % 2 == 0) return 1;
  return 0;
}
void doublesetprecision(double x, int p) {
  cout << fixed << setprecision(p) << x;
}
long long MOD(long long x, long long M) {
  x = x % M;
  if (x < 0) x += M;
  return x;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
