#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, a, b, m, k, i, j, maxi, mxi;
  cin >> n >> a >> b;
  maxi = 0;
  for (i = 0; i < a; i++) {
    cin >> m;
    maxi = max(maxi, m);
  }
  mxi = 0;
  for (j = 0; j < b; j++) {
    cin >> k;
    mxi = max(mxi, k);
  }
  if (maxi > mxi)
    cout << "YES"
         << "\n";
  else
    cout << "NO"
         << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
