#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k[2];
    cin >> n >> k[0] >> k[1];
    int a[maxn], b[maxn];
    for (int i = 0; i < k[0]; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < k[1]; i++) {
      cin >> b[i];
    }
    int aaa = *max_element(a, a + k[0]);
    int bbb = *max_element(b, b + k[1]);
    if (aaa > bbb) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
