#include <bits/stdc++.h>
using namespace std;
long long n, m, MAX, MAX1, a, T;
int main() {
  cin >> T;
  while (T--) {
    MAX = 0;
    MAX1 = 0;
    cin >> n >> n >> m;
    for (int i = 1; i <= n; i++) {
      cin >> a;
      MAX = max(MAX, a);
    }
    for (int i = 1; i <= m; i++) {
      cin >> a;
      MAX1 = max(MAX1, a);
    }
    if (MAX > MAX1)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
