#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, a, b;
  cin >> t;
  while (t--) {
    cin >> n >> a >> b;
    int temp;
    int mx1 = 0, mx2 = 0;
    for (int i = 0; i < a; i++) {
      cin >> temp;
      mx1 = max(mx1, temp);
    }
    for (int i = 0; i < b; i++) {
      cin >> temp;
      mx2 = max(mx2, temp);
    }
    if (mx1 > mx2)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
