#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    int a, b, c, aa = 0, bb = 0, m, n;
    cin >> a >> b >> c;
    for (long long i = 0; i < b; i++) {
      cin >> m;
      if (m > aa) aa = m;
    }
    for (long long i = 0; i < c; i++) {
      cin >> n;
      if (n > bb) bb = n;
    }
    if (aa > bb)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
