#include <bits/stdc++.h>
using namespace std;
const int LM = 100;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t, n, k1, k2, a[100];
  cin >> t;
  while (t--) {
    cin >> n >> k1 >> k2;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + k1);
    if (a[k1 - 1] == n)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
