#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n, k1, k2;
    cin >> n >> k1 >> k2;
    int a;
    int mx1 = 0;
    for (int j = 0; j < k1; j++) {
      cin >> a;
      if (a > mx1) {
        mx1 = a;
      }
    }
    int mx2 = 0;
    for (int j = 0; j < k2; j++) {
      cin >> a;
      if (a > mx2) {
        mx2 = a;
      }
    }
    if (mx1 > mx2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
