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