#include <bits/stdc++.h>
using namespace std;
long long q, i, n, k1, k2, a, b, mx1, mx2;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> q;
  while (q--) {
    cin >> n >> k1 >> k2;
    mx1 = -1e16;
    mx2 = -1e16;
    for (i = 1; i <= k1; i++) {
      cin >> a;
      mx1 = max(mx1, a);
    }
    for (i = 1; i <= k2; i++) {
      cin >> b;
      mx2 = max(mx2, b);
    }
    if (mx1 > mx2)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
  return 0;
}
