#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
void solve() {
  int n, x, y;
  cin >> n >> x >> y;
  vector<int> a(x), b(y);
  for (auto& i : a) cin >> i;
  for (auto& i : b) cin >> i;
  cout << ((*max_element(a.begin(), a.end()) > *max_element(b.begin(), b.end()))
               ? "YES"
               : "NO")
       << endl;
}
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  srand(time(0));
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
