#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
const double PI = 3.14;
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
void solve() {
  int n, k1, k2, m1 = INT_MIN, m2 = INT_MIN, k;
  cin >> n >> k1 >> k2;
  for (int i = 0; i < k1; i++) {
    cin >> k;
    m1 = max(m1, k);
  }
  for (int i = 0; i < k2; i++) {
    cin >> k;
    m2 = max(m2, k);
  }
  cout << (m1 > m2 ? "YES" : "NO") << "\n";
}
