#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k1, k2;
    cin >> n >> k1 >> k2;
    bool ya = 0;
    while (k1--) {
      int a;
      cin >> a;
      if (a == n) {
        ya = 1;
      }
    }
    while (k2--) {
      int a;
      cin >> a;
    }
    if (ya) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
