#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int t;
  cin >> t;
  while (t--) {
    int n, a, b, val;
    cin >> n >> a >> b;
    bool ans = false;
    for (int i = 0; i < a; i++) {
      cin >> val;
      if (val == n) ans = true;
    }
    for (int i = 0; i < b; i++) cin >> val;
    if (ans)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
