#include <bits/stdc++.h>
using namespace std;
int main() {
  long long T;
  scanf("%lld", &T);
  while (T--) {
    long long n, k1, k2, max1 = -1, max2 = -2;
    scanf("%lld", &n), scanf("%lld", &k1), scanf("%lld", &k2);
    for (long long i = 1; i <= k1; i++) {
      long long a;
      scanf("%lld", &a);
      max1 = max(a, max1);
    }
    for (long long i = 1; i <= k2; i++) {
      long long a;
      scanf("%lld", &a);
      max2 = max(a, max2);
    }
    if (max1 > max2)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
