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