#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, a, b, i, j, suma = 0, sumb = 0;
  cin >> t;
  while (t--) {
    cin >> n >> a >> b;
    int x[a], y[b];
    for (i = 0; i < a; i++) {
      cin >> x[i];
      if (x[i] > suma) {
        suma = x[i];
      }
    }
    for (j = 0; j < b; j++) {
      cin >> y[j];
      if (y[j] > sumb) {
        sumb = y[j];
      }
    }
    if (suma > sumb) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    suma = 0;
    sumb = 0;
  }
  return 0;
}
