#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, k1, k2, f1, f2, n, max1 = 0, max2 = 0;
  cin >> t;
  while (t--) {
    cin >> n >> k1 >> k2;
    max1 = 0, max2 = 0;
    while (k1--) {
      cin >> f1;
      if (max1 <= f1) {
        max1 = f1;
      }
    }
    while (k2--) {
      cin >> f2;
      if (max2 <= f2) {
        max2 = f2;
      }
    }
    if (max1 > max2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
