#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  for (long long cyc = 0; cyc < t; ++cyc) {
    long long n, k1, k2;
    cin >> n >> k1 >> k2;
    long long x;
    long long ma1 = (-1);
    long long ma2 = (-1);
    for (long long i = 0; i < k1; ++i) {
      cin >> x;
      ma1 = max(ma1, x);
    }
    for (long long i = 0; i < k2; ++i) {
      cin >> x;
      ma2 = max(ma2, x);
    }
    if (ma1 > ma2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
