#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, k1, k2, i, j;
  cin >> t;
  while (t--) {
    cin >> n >> k1 >> k2;
    int a[k1 + 5], b[k2 + 5], maxx = 0, p = 0;
    for (i = 0; i < k1; i++) {
      cin >> a[i];
      maxx = max(maxx, a[i]);
    }
    for (i = 0; i < k2; i++) {
      cin >> b[i];
      if (b[i] > maxx) {
        p = 1;
      }
    }
    if (p == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
