#include <bits/stdc++.h>
using namespace std;
map<int, int> map1;
vector<int> alice, bob;
int n, m, K, a[300100], b[300100];
int c1[300100], c2[300100];
int mini(int a, int b) {
  if (a < b) return a;
  return b;
}
int main() {
  int i, j, k, l, test, t = 1;
  scanf("%d %d %d", &n, &m, &K);
  int tot = 1;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (map1[a[i]] == 0) {
      map1[a[i]] = tot++;
    }
    k = map1[a[i]];
    c1[k]++;
  }
  for (i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
    if (map1[b[i]] == 0) {
      map1[b[i]] = tot++;
    }
    k = map1[b[i]];
    c2[k]++;
  }
  for (i = 1; i < tot; i++) {
    k = mini(c1[i], c2[i]);
    c1[i] -= k;
    c2[i] -= k;
  }
  for (i = 1; i <= n; i++) {
    if (c1[map1[a[i]]] <= 0) continue;
    alice.push_back(a[i]);
    c1[map1[a[i]]]--;
  }
  sort(alice.begin(), alice.end());
  for (i = 1; i <= m; i++) {
    if (c2[map1[b[i]]] <= 0) continue;
    bob.push_back(b[i]);
    c2[map1[b[i]]]--;
  }
  sort(bob.begin(), bob.end());
  int flag = 0;
  for (i = alice.size() - 1, j = bob.size() - 1;; i--, j--) {
    if (i < 0) break;
    if (j < 0) {
      flag = 1;
      break;
    }
    if (alice[i] > bob[j]) {
      flag = 1;
      break;
    }
  }
  if (flag)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
