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