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