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