#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long x, n, m;
  cin >> x >> n >> m;
  long long maxx1 = 0;
  long long maxx2 = 0;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    maxx1 = max(maxx1, x);
  }
  for (int i = 0; i < m; i++) {
    long long x;
    cin >> x;
    maxx2 = max(maxx2, x);
  }
  if (maxx1 >= maxx2)
    cout << "YES"
         << "\n";
  else
    cout << "NO"
         << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) solve();
}
