#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k1, k2, i, j;
  int m1, m2;
  m1 = m2 = INT_MIN;
  cin >> n >> k1 >> k2;
  for (i = 0; i < k1; i++) cin >> j, m1 = max(m1, j);
  for (i = 0; i < k2; i++) cin >> j, m2 = max(m2, j);
  if (m1 > m2)
    cout << "YES";
  else
    cout << "NO";
  cout << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
}
