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