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