#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int t;
int n, k1, k2;
int a[N], b[N];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d %d %d", &n, &k1, &k2);
    int ma = 0, mb = 0;
    for (int i = 1; i <= k1; i++) {
      scanf("%d", &a[i]);
      ma = max(ma, a[i]);
    }
    for (int i = 1; i <= k2; i++) {
      scanf("%d", &b[i]);
      mb = max(mb, b[i]);
    }
    if (ma > mb)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
