#include <bits/stdc++.h>
using namespace std;
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int t;
  cin >> t;
  for (; t > 0; --t) {
    int n, k1, k2;
    cin >> n >> k1 >> k2;
    bool b = true;
    vector<int> a1(k1);
    vector<int> a2(k2);
    for (int i = 0; i < k1; ++i) {
      cin >> a1[i];
    }
    for (int i = 0; i < k2; ++i) {
      cin >> a2[i];
      if (a2[i] == n) b = false;
    }
    if (b == true)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
