#include <bits/stdc++.h>
using namespace std;
int t;
int n, k1, k2;
int a[121], b[121];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d%d", &n, &k1, &k2);
    int mx1 = 0, mx2 = 0;
    for (int i = 1; i <= k1; ++i) {
      scanf("%d", a + i);
      mx1 = max(mx1, a[i]);
    }
    for (int i = 1; i <= k2; ++i) {
      scanf("%d", b + i);
      mx2 = max(mx2, b[i]);
    }
    if (mx1 > mx2)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
