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