#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a1, b1, c1, ma = 0, maa = 0, x1, y1;
    cin >> a1 >> b1 >> c1;
    for (int i = 0; i < b1; i++) {
      cin >> x1;
      ma = max(x1, ma);
    }
    for (int i = 0; i < c1; i++) {
      cin >> y1;
      maa = max(y1, maa);
    }
    if (ma > maa) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
