#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k1, k2;
    cin >> n >> k1 >> k2;
    vector<long long> a1(k1);
    vector<long long> a2(k2);
    for (long long i = 0; i < k1; i++) cin >> a1[i];
    for (long long i = 0; i < k2; i++) cin >> a2[i];
    sort(a1.begin(), a1.end());
    sort(a2.begin(), a2.end());
    if (a1.back() > a2.back())
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
