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