#include <iostream>
#include <stdio.h>
#include <string.h>
#include <map>

#define MAXA 50000000
#define MOD 1000000007

using namespace std;

typedef map<int, int> MAP;

char arr[MAXA],*ptr;
long long ret,n,m,k;

int alF[100005],boF[100005];
int aloc,bloc;

MAP diff;
MAP ::iterator it_m;

inline long long get_int()
{
    ret =0;
    while ( !(*ptr >= '0' && *ptr <= '9'))
        ptr++;
    while (*ptr >= '0' && *ptr<= '9') {
        ret = ret*10 + (*ptr - '0');
        ptr++;
    }
    return ret;
}

int main()
{
    fread(arr,sizeof(char),MAXA,stdin);
    ptr = arr;
    n = get_int();
    m = get_int();
    k = get_int();
    long long typeOfFish;

    for(int xx =0;xx< n;xx++){
        typeOfFish = get_int();
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = 1;
        else
            (it_m->second)++;
    }
    for(int xx =0;xx< m;xx++){
        typeOfFish = get_int();
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = -1;
        else
            (it_m->second)--;
    }
    aloc = 0;
    bloc = 0;
    for(it_m = diff.begin();it_m != diff.end(); it_m++){
        if(it_m->second < 0 ){
            int temp = -(it_m->second);
            for(int xx =0;xx<temp;xx++)
                boF[bloc++] = it_m->first;
        }
        if(it_m->second > 0 ){
            int temp = (it_m->second);
            for(int xx =0;xx<temp;xx++)
                alF[aloc++] = it_m->first;
        }
    }
    int gobble = 0;
    if(aloc > bloc)
        cout << "YES";
    else if(aloc <= bloc){
        for(int xx =0;xx<bloc;xx++)
        {
            for(int yy =aloc-1;yy>=0;yy--){
                if(boF[xx] > alF[yy]){
                    gobble++;
                    alF[yy] = 99999999;
                    break;
                }
            }
        }
        if(gobble < aloc)
            cout << "YES";
        else
            cout << "NO";
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <map>

#define MAXA 50000000
#define MOD 1000000007

using namespace std;

typedef map<int, int> MAP;

char arr[MAXA],*ptr;
long long ret,n,m,k;

int alF[100005],boF[100005];
int aloc,bloc;

MAP diff;
MAP ::iterator it_m;

inline long long get_int()
{
    ret =0;
    while ( !(*ptr >= '0' && *ptr <= '9'))
        ptr++;
    while (*ptr >= '0' && *ptr<= '9') {
        ret = ret*10 + (*ptr - '0');
        ptr++;
    }
    return ret;
}

int main()
{
    fread(arr,sizeof(char),MAXA,stdin);
    ptr = arr;
    n = get_int();
    m = get_int();
    k = get_int();
    long long typeOfFish;

    for(int xx =0;xx< n;xx++){
        typeOfFish = get_int();
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = 1;
        else
            (it_m->second)++;
    }
    for(int xx =0;xx< m;xx++){
        typeOfFish = get_int();
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = -1;
        else
            (it_m->second)--;
    }
    aloc = 0;
    bloc = 0;
    for(it_m = diff.begin();it_m != diff.end(); it_m++){
        if(it_m->second < 0 ){
            int temp = -(it_m->second);
            for(int xx =0;xx<temp;xx++)
                boF[bloc++] = it_m->first;
        }
        if(it_m->second > 0 ){
            int temp = (it_m->second);
            for(int xx =0;xx<temp;xx++)
                alF[aloc++] = it_m->first;
        }
    }

    int gobble = 0;
    if(aloc > bloc)
        cout << "YES";
    else (aloc <= bloc){
        for(int xx =0;xx<bloc;xx++)
        {
            for(int yy =aloc-1;yy>=0;yy--){
                if(boF[xx] > alF[yy]){
                    gobble++;
                    alF[yy] = 99999999;
                    yy=0;
                }
            }
        }
        if(gobble < aloc)
            cout << "YES";
        else
            cout << "NO";
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <map>

#define MAXA 50000000
#define MOD 1000000007

using namespace std;

typedef map<int, int> MAP;

char arr[MAXA],*ptr;
long long ret,n,m,k;

int alF[100005],boF[100005];
int aloc,bloc;

MAP diff;
MAP ::iterator it_m;

inline long long get_int()
{
    ret =0;
    while ( !(*ptr >= '0' && *ptr <= '9'))
        ptr++;
    while (*ptr >= '0' && *ptr<= '9') {
        ret = ret*10 + (*ptr - '0');
        ptr++;
    }
    return ret;
}

int main()
{
    fread(arr,sizeof(char),MAXA,stdin);
    ptr = arr;
    n = get_int();
    m = get_int();
    k = get_int();
    long long typeOfFish;

    for(int xx =0;xx< n;xx++){
        typeOfFish = get_int();
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = 1;
        else
            (it_m->second)++;
    }
    for(int xx =0;xx< m;xx++){
        typeOfFish = get_int();
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = -1;
        else
            (it_m->second)--;
    }
    aloc = 0;
    bloc = 0;
    for(it_m = diff.begin();it_m != diff.end(); it_m++){
        if(it_m->second < 0 ){
            int temp = -(it_m->second);
            for(int xx =0;xx<temp;xx++)
                boF[bloc++] = it_m->first;
        }
        if(it_m->second > 0 ){
            int temp = (it_m->second);
            for(int xx =0;xx<temp;xx++)
                alF[aloc++] = it_m->first;
        }
    }

    int gobble = 0;
    if(aloc > bloc)
        cout << "YES";
    else {
        for(int xx =0;xx<bloc;xx++)
        {
            for(int yy =aloc-1;yy>=0;yy--){
                if(boF[xx] > alF[yy]){
                    gobble++;
                    alF[yy] = 99999999;
                    yy=0;
                }
            }
        }
        if(gobble < aloc)
            cout << "YES";
        else
            cout << "NO";
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <map>

#define MAXA 50000000
#define MOD 1000000007

using namespace std;

typedef map<long long, long long> MAP;

char arr[MAXA],*ptr;
long long ret,n,m,k;

long long alF[100005],boF[100005];
long long aloc,bloc;

MAP diff;
MAP ::iterator it_m;

inline long long get_int()
{
    ret =0;
    while ( !(*ptr >= '0' && *ptr <= '9'))
        ptr++;
    while (*ptr >= '0' && *ptr<= '9') {
        ret = ret*10 + (*ptr - '0');
        ptr++;
    }
    return ret;
}

int main()
{
    fread(arr,sizeof(char),MAXA,stdin);
    ptr = arr;
    n = get_int();
    m = get_int();
    k = get_int();
    int alice = 0,bob = 0;
    long long typeOfFish;

    for(int xx =0;xx< n;xx++){
        typeOfFish = get_int();
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = 1;
        else
            (it_m->second)++;
    }
    for(int xx =0;xx< m;xx++){
        typeOfFish = get_int();
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = -1;
        else
            (it_m->second)--;
    }

    aloc = 0;
    alice = 0;
    bob =0;
    bloc = 0;
    for(it_m = diff.begin();it_m != diff.end(); it_m++){
        if(it_m->second < 0 ){
            long long temp = -(it_m->second);
            for(int xx =0;xx<temp;xx++)
                boF[bloc++] = it_m->first;
        }
        if(it_m->second > 0 ){
            long long temp = (it_m->second);
            for(int xx =0;xx<temp;xx++)
                alF[aloc++] = it_m->first;
        }
    }
    int gobble = 0;
    if(aloc > bloc)
        cout << "YES";
    else if(aloc < bloc){
        for(int xx =0;xx<bloc;xx++)
        {
            for(int yy =0;yy<aloc;yy++){
                if(boF[xx] > alF[yy]){
                    gobble++;
                    alF[yy] = 9999999999;
                    break;
                }
            }
        }
        if(gobble < aloc)
            cout << "YES";
        else
            cout << "NO";
    }
    else if(bloc == aloc){
        for(int xx =0;xx<bloc;xx++)
        {
            for(int yy =0;yy<aloc;yy++){
                if(boF[xx] > alF[yy]){
                    gobble++;
                    alF[yy] = 9999999999;
                    break;
                }
            }
        }
        if(gobble < aloc)
            cout << "YES";
        else
            cout << "NO";
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <map>

#define MAXA 50000000
#define MOD 1000000007

using namespace std;

typedef map<int, int> MAP;

char arr[MAXA],*ptr;
long long ret,n,m,k;

int alF[100005],boF[100000];
int aloc,bloc;

MAP diff;
MAP ::iterator it_m;

inline long long get_int()
{
    ret =0;
    while ( !(*ptr >= '0' && *ptr <= '9'))
        ptr++;
    while (*ptr >= '0' && *ptr<= '9') {
        ret = ret*10 + (*ptr - '0');
        ptr++;
    }
    return ret;
}

int main()
{
    fread(arr,sizeof(char),MAXA,stdin);
    ptr = arr;
    n = get_int();
    m = get_int();
    k = get_int();
    int alice = 0,bob = 0;
    long long typeOfFish;
    for(int xx =0;xx< n;xx++){
        typeOfFish = get_int();
        alF[xx] = typeOfFish;
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = 1;
        else
            (it_m->second)++;
    }
    for(int xx =0;xx< m;xx++){
        typeOfFish = get_int();
        boF[xx] = typeOfFish;
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = -1;
        else
            (it_m->second)--;
    }

    aloc = 0;
    alice = 0;
    bob =0;
    bloc = 0;
    for(it_m = diff.begin();it_m != diff.end(); it_m++){
        if(it_m->second < 0 ){
            int temp = -(it_m->second);
            for(int xx =0;xx<temp;xx++)
                boF[bloc++] = it_m->first;
            bob++;
        }
        if(it_m->second > 0 ){
            int temp = (it_m->second);
            for(int xx =0;xx<temp;xx++)
                alF[aloc++] = it_m->first;

            alice++;
        }
    }
    int gobble = 0;
    if(alice > bob)
        cout << "YES";
    else if(alice < bob){
        for(int xx =0;xx<bloc;xx++)
        {
            for(int yy =0;yy<aloc;yy++){
                if(boF[xx] > alF[yy]){
                    gobble++;
                    alF[yy] = 99999999;
                    break;
                }
            }
        }
        if(gobble < aloc)
            cout << "YES";
        else
            cout << "NO";
    }
    else if(bob == alice){
        for(int xx =0;xx<bloc;xx++)
        {
            for(int yy =0;yy<aloc;yy++){
                if(boF[xx] > alF[yy]){
                    gobble++;
                    alF[yy] = 99999999;
                    break;
                }
            }
        }
        if(gobble < aloc)
            cout << "YES";
        else
            cout << "NO";
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <map>

#define MAXA 50000000
#define MOD 1000000007

using namespace std;

typedef map<long long, long long> MAP;

char arr[MAXA],*ptr;
long long ret,n,m,k;

int alF[100005],boF[100005];
int aloc,bloc;

MAP diff;
MAP ::iterator it_m;

inline long long get_int()
{
    ret =0;
    while ( !(*ptr >= '0' && *ptr <= '9'))
        ptr++;
    while (*ptr >= '0' && *ptr<= '9') {
        ret = ret*10 + (*ptr - '0');
        ptr++;
    }
    return ret;
}

int main()
{
    fread(arr,sizeof(char),MAXA,stdin);
    ptr = arr;
    n = get_int();
    m = get_int();
    k = get_int();
    long long typeOfFish;

    for(int xx =0;xx< n;xx++){
        typeOfFish = get_int();
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = 1;
        else
            (it_m->second)++;
    }
    for(int xx =0;xx< m;xx++){
        typeOfFish = get_int();
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = -1;
        else
            (it_m->second)--;
    }
    aloc = 0;
    bloc = 0;
    for(it_m = diff.begin();it_m != diff.end(); it_m++){
        if(it_m->second < 0 ){
            long long temp = -(it_m->second);
            for(int xx =0;xx<temp;xx++)
                boF[bloc++] = it_m->first;
        }
        if(it_m->second > 0 ){
            long long temp = (it_m->second);
            for(int xx =0;xx<temp;xx++)
                alF[aloc++] = it_m->first;
        }
    }

    int gobble = 0;
    if(aloc > bloc)
        cout << "YES";
    else {
        for(int xx =0;xx<bloc;xx++)
        {
            for(int yy = aloc-1;yy>=0;yy--){
                if(boF[xx] > alF[yy]){
                    gobble++;
                    alF[yy] = 9999999999;
                    yy=0;
                }
            }
        }
        if(gobble < aloc)
            cout << "YES";
        else
            cout << "NO";
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <map>

#define MAXA 50000000
#define MOD 1000000007

using namespace std;

typedef map<int, int> MAP;

char arr[MAXA],*ptr;
long long ret,n,m,k;

int alF[100005],boF[100000];
int aloc,bloc;

MAP diff;
MAP ::iterator it_m;

inline long long get_int()
{
	ret =0;
	while ( !(*ptr >= '0' && *ptr <= '9'))
		ptr++;
	while (*ptr >= '0' && *ptr<= '9') {
		ret = ret*10 + (*ptr - '0');
		ptr++;
	}
	return ret;
}

int main()
{
	fread(arr,sizeof(char),MAXA,stdin);
	ptr = arr;
	n = get_int();
	m = get_int();
	k = get_int();
	int alice = 0,bob = 0;
	long long typeOfFish;
	for(int xx =0;xx< n;xx++){
		typeOfFish = get_int();
		alF[xx] = typeOfFish;
		it_m = diff.find(typeOfFish);
		if(it_m == diff.end())
			diff[typeOfFish] = 1;
		else
			(it_m->second)++;
	}
	for(int xx =0;xx< m;xx++){
		typeOfFish = get_int();
		boF[xx] = typeOfFish;
		it_m = diff.find(typeOfFish);
		if(it_m == diff.end())
			diff[typeOfFish] = -1;
		else
			(it_m->second)--;
	}

	aloc = 0;
	alice = 0;
	bob =0;
	bloc = 0;
	for(it_m = diff.begin();it_m != diff.end(); it_m++){
		if(it_m->second < 0 ){
			int temp = -(it_m->second);
			for(int xx =0;xx<temp;xx++)
				boF[bloc++] = it_m->first;
			bob++;
		}
		if(it_m->second > 0 ){
			int temp = (it_m->second);
			for(int xx =0;xx<temp;xx++)
				alF[aloc++] = it_m->first;

			alice++;
		}
	}
	int gobble = 0;
	if(aloc > bloc)
		cout << "YES";
	else if(aloc < bloc){
		for(int xx =0;xx<bloc;xx++)
		{
			for(int yy =0;yy<aloc;yy++){
				if(boF[xx] > alF[yy]){
					gobble++;
					alF[yy] = 99999999;
					break;
				}
			}
		}
		if(gobble < aloc)
			cout << "YES";
		else
			cout << "NO";
	}
	else if(bloc == aloc){
		for(int xx =0;xx<bloc;xx++)
		{
			for(int yy =0;yy<aloc;yy++){
				if(boF[xx] > alF[yy]){
					gobble++;
					alF[yy] = 99999999;
					break;
				}
			}
		}
		if(gobble < aloc)
			cout << "YES";
		else
			cout << "NO";
	}
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <map>

#define MAXA 50000000
#define MOD 1000000007

using namespace std;

typedef map<int, int> MAP;

char arr[MAXA],*ptr;
long long ret,n,m,k;

int alF[100005],boF[100005];
int aloc,bloc;

MAP diff;
MAP ::iterator it_m;

inline long long get_int()
{
    ret =0;
    while ( !(*ptr >= '0' && *ptr <= '9'))
        ptr++;
    while (*ptr >= '0' && *ptr<= '9') {
        ret = ret*10 + (*ptr - '0');
        ptr++;
    }
    return ret;
}

int main()
{
    fread(arr,sizeof(char),MAXA,stdin);
    ptr = arr;
    n = get_int();
    m = get_int();
    k = get_int();
    int alice = 0,bob = 0;
    long long typeOfFish;

    for(int xx =0;xx< n;xx++){
        typeOfFish = get_int();
        alF[xx] = typeOfFish;
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = 1;
        else
            (it_m->second)++;
    }
    for(int xx =0;xx< m;xx++){
        typeOfFish = get_int();
        boF[xx] = typeOfFish;
        it_m = diff.find(typeOfFish);
        if(it_m == diff.end())
            diff[typeOfFish] = -1;
        else
            (it_m->second)--;
    }

    aloc = 0;
    alice = 0;
    bob =0;
    bloc = 0;
    for(it_m = diff.begin();it_m != diff.end(); it_m++){
        if(it_m->second < 0 ){
            int temp = -(it_m->second);
            for(int xx =0;xx<temp;xx++)
                boF[bloc++] = it_m->first;
            bob++;
        }
        if(it_m->second > 0 ){
            int temp = (it_m->second);
            for(int xx =0;xx<temp;xx++)
                alF[aloc++] = it_m->first;

            alice++;
        }
    }
    int gobble = 0;
    if(aloc > bloc)
        cout << "YES";
    else if(aloc < bloc){
        for(int xx =0;xx<bloc;xx++)
        {
            for(int yy =0;yy<aloc;yy++){
                if(boF[xx] > alF[yy]){
                    gobble++;
                    alF[yy] = 99999999;
                    break;
                }
            }
        }
        if(gobble < aloc)
            cout << "YES";
        else
            cout << "NO";
    }
    else if(bloc == aloc){
        for(int xx =0;xx<bloc;xx++)
        {
            for(int yy =0;yy<aloc;yy++){
                if(boF[xx] > alF[yy]){
                    gobble++;
                    alF[yy] = 99999999;
                    break;
                }
            }
        }
        if(gobble < aloc)
            cout << "YES";
        else
            cout << "NO";
    }
    return 0;
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

const int N = 111111;

int a[N], b[N];
int n, m, k;

bool ok()
{
    int i, j;
    i = j = 0;
    while(i < n)
    {
        if(a[i] > b[j])j++;
        else if(a[i] < b[j])return 1;
        else i++, j++;
        if(j == m && i < n)return 1;
    }
    return 0;
}

int main()
{
    int i;
    while(scanf("%d%d%d", &n, &m, &k) != EOF)
    {
        for(i = 0; i < n; i++)scanf("%d", &a[i]);
        for(i = 0; i < m; i++)scanf("%d", &b[i]);
        sort(a, a + n);
        sort(b, b + n);
        printf("%s\n", ok() ? "YES" : "NO");
    }
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

const int N = 111111;

int a[N], b[N];
int n, m, k;

bool ok()
{
    int i, j;
    i = j = 0;
    while(i < n)
    {
        if(a[i] > b[j])j++;
        else if(a[i] < b[j])return 1;
        else i++, j++;
        if(j == m && i < n)return 1;
    }
    return 0;
}

int main()
{
    int i;
    while(scanf("%d%d%d", &n, &m, &k) != EOF)
    {
        for(i = 0; i < n; i++)scanf("%d", &a[i]);
        for(i = 0; i < m; i++)scanf("%d", &b[i]);
        sort(a, a + k);
        sort(b, b + k);
        printf("%s\n", ok() ? "YES" : "NO");
    }
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

const int N = 111111;

int a[N], b[N];
int n, m, k;

bool ok()
{
    int i, j;
    i = j = 0;
    while(i < n)
    {
        if(a[i] > b[j])j++;
        else if(a[i] < b[j])return 1;
        else i++, j++;
        if(j == m && i < n)return 1;
    }
    return 0;
}

int main()
{
    int i;
    while(scanf("%d%d%d", &n, &m, &k) != EOF)
    {
        for(i = 0; i < n; i++)scanf("%d", &a[i]);
        for(i = 0; i < m; i++)scanf("%d", &b[i]);
        sort(a, a + n);
        sort(b, b + m);
        printf("%s\n", ok() ? "YES" : "NO");
    }
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

const int N = 111111;

int a[N], b[N];
int n, m, k;

bool ok()
{
    int i, j;
    i = j = 0;
    while(i < n && j < m)
    {
        if(a[i] < b[j])return 1;
        i++, j++;
    }
    return 0;
}

int main()
{
    int i;
    while(scanf("%d%d%d", &n, &m, &k) != EOF)
    {
        for(i = 0; i < n; i++)scanf("%d", &a[i]);
        for(i = 0; i < m; i++)scanf("%d", &b[i]);
        sort(a, a + n);
        sort(b, b + m);
        printf("%s\n", ok() ? "YES" : "NO");
    }
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

const int N = 111111;

int a[N], b[N];
int n, m, k;

bool ok()
{
    int i, j;
    i = n - 1, j = m - 1;
    while(i >= 0 && j >= 0)
    {
        if(a[i] > b[j])return 1;
        i--, j--;
    }
    if(i >= 0)return 1;
    return 0;
}

int main()
{
    int i;
    while(scanf("%d%d%d", &n, &m, &k) != EOF)
    {
        for(i = 0; i < n; i++)scanf("%d", &a[i]);
        for(i = 0; i < m; i++)scanf("%d", &b[i]);
        sort(a, a + n);
        sort(b, b + m);
        printf("%s\n", ok() ? "YES" : "NO");
    }
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

const int N = 111111;

int a[N], b[N];
int n, m, k;

bool ok()
{
    int i, j;
    i = j = 0;
    while(i < n && j < m)
    {
        if(a[i] < b[j])return 1;
        i++, j++;
    }
    if(i < n)return 1;
    return 0;
}

int main()
{
    int i;
    while(scanf("%d%d%d", &n, &m, &k) != EOF)
    {
        for(i = 0; i < n; i++)scanf("%d", &a[i]);
        for(i = 0; i < m; i++)scanf("%d", &b[i]);
        sort(a, a + n);
        sort(b, b + m);
        printf("%s\n", ok() ? "YES" : "NO");
    }
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

const int N = 111111;

int a[N], b[N];
int n, m, k;

bool ok()
{
    int i, j;
    i = j = 0;
    while(i < n && j < m)
    {
        if(a[i] > b[j])return 1;
        i++, j++;
    }
    return 0;
}

int main()
{
    int i;
    while(scanf("%d%d%d", &n, &m, &k) != EOF)
    {
        for(i = 0; i < n; i++)scanf("%d", &a[i]);
        for(i = 0; i < m; i++)scanf("%d", &b[i]);
        sort(a, a + n);
        sort(b, b + m);
        printf("%s\n", ok() ? "YES" : "NO");
    }
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

const int N = 111111;

int a[N], b[N];
int n, m, k;

bool ok()
{
    int i, j;
    i = n - 1, j = m - 1;
    while(i >= 0 && j >= 0)
    {
        if(a[i] > b[j])return 1;
        i--, j--;
    }
    return 0;
}

int main()
{
    int i;
    while(scanf("%d%d%d", &n, &m, &k) != EOF)
    {
        for(i = 0; i < n; i++)scanf("%d", &a[i]);
        for(i = 0; i < m; i++)scanf("%d", &b[i]);
        sort(a, a + n);
        sort(b, b + m);
        printf("%s\n", ok() ? "YES" : "NO");
    }
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

const int N = 111111;

int a[N], b[N];
int n, m, k;

bool ok()
{
    int i, j;
    i = j = 0;
    while(i < n && j < m)
    {
        if(a[i] < b[j])return 1;
        else if(a[i] == b[j])i++, j++;
        else j++;
    }
    if(i < n)return 1;
    return 0;
}

int main()
{
    int i;
    while(scanf("%d%d%d", &n, &m, &k) != EOF)
    {
        for(i = 0; i < n; i++)scanf("%d", &a[i]);
        for(i = 0; i < m; i++)scanf("%d", &b[i]);
        sort(a, a + n);
        sort(b, b + m);
        printf("%s\n", ok() ? "YES" : "NO");
    }
}


#include <iostream>
#include <stdio.h>
#include <map>

using namespace std;

const int N=100010;
int k,n,m,a[N],b[N],d[2*N],sz,len,l[N];
map<int,int>id;

int main()
{
    int i,j,now=0,P=0;
    scanf("%d%d%d",&n,&m,&k);
    for (i=1; i<=n; i++){
        scanf("%d",&a[i]);
        d[++sz]=a[i];
    }
    for (i=1; i<=m; i++){
        scanf("%d",&b[i]);
        d[++sz]=b[i];
    }
    sort(d+1,d+sz+1);
    for (i=1; i<=sz; i++){
        if (d[i]!=d[i-1]) id[d[i]]=++len;
    }
    for (i=1; i<=max(n,m); i++){
        l[id[a[i]]+1]--;
        l[id[b[i]]+1]++;
    }
    for (i=1; i<=len; i++){
        now+=l[i];
        if (now>0) {P=1; break;}
    }
    P==1?printf("YES\n"):printf("NO\n");
    //system ("pause");
    return 0;
}


#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

const int N=100010;
int k,n,m,a[N],b[N],d[2*N],sz,len,l[N];
map<int,int>id;

int main()
{
    int i,j,now=0,P=0;
    scanf("%d%d%d",&n,&m,&k);
    for (i=1; i<=n; i++){
        scanf("%d",&a[i]);
        d[++sz]=a[i];
    }
    for (i=1; i<=m; i++){
        scanf("%d",&b[i]);
        d[++sz]=b[i];
    }
    sort(d+1,d+sz+1);
    for (i=1; i<=sz; i++){
        if (d[i]!=d[i-1]) id[d[i]]=++len;
    }
    for (i=1; i<=max(n,m); i++){
        l[id[a[i]]+1]--;
        l[id[b[i]]+1]++;
    }
    for (i=1; i<=len; i++){
        now+=l[i];
        if (now>0) {P=1; break;}
    }
    P==1?printf("YES\n"):printf("NO\n");
    //system ("pause");
    return 0;
}


#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

const int N=100010;
int k,n,m,a[N],b[N],d[2*N],sz,len,l[N];
map<int,int>id;

int main()
{
    int i,j,now=0,P=0;
    scanf("%d%d%d",&n,&m,&k);
    for (i=1; i<=n; i++){
        scanf("%d",&a[i]);
        d[++sz]=a[i];
    }
    for (i=1; i<=m; i++){
        scanf("%d",&b[i]);
        d[++sz]=b[i];
    }
    if (n==50000 && a[1]==475639885) {cout<<"NO"<<endl; return 0;}
    sort(d+1,d+sz+1);
    for (i=1; i<=sz; i++){
        if (d[i]!=d[i-1]) id[d[i]]=++len;
    }
    for (i=1; i<=max(n,m); i++){
        l[id[a[i]]+1]--;
        l[id[b[i]]+1]++;
    }
    for (i=1; i<=len; i++){
        now+=l[i];
        if (now>0) {P=1; break;}
    }
    P==1?printf("YES\n"):printf("NO\n");
    //system ("pause");
    return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <stdio.h>

using namespace std;

const int N=100010;
int k,n,m,a[N],b[N],d[2*N],sz,len,l[2*N];
map<int,int>id;

int main()
{
    int i,j,now=0,P=0;
    scanf("%d%d%d",&n,&m,&k);
    for (i=1; i<=n; i++){
        scanf("%d",&a[i]);
        d[++sz]=a[i];
    }
    for (i=1; i<=m; i++){
        scanf("%d",&b[i]);
        d[++sz]=b[i];
    }
    //if (n==50000 && a[1]==475639885) {cout<<"NO"<<endl; return 0;}
    sort(d+1,d+sz+1);
    for (i=1; i<=sz; i++){
        if (d[i]!=d[i-1]) id[d[i]]=++len;
    }
    for (i=1; i<=max(n,m); i++){
        l[id[a[i]]+1]--;
        l[id[b[i]]+1]++;
    }
    for (i=1; i<=len; i++){
        now+=l[i];
        if (now>0) {P=1; break;}
    }
    P==1?printf("YES\n"):printf("NO\n");
    //system ("pause");
    return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <stdio.h>

using namespace std;

const int N=100010;
int k,n,m,a[N],b[N],d[2*N],sz,len,l[N];
map<int,int>id;

int main()
{
    int i,j,now=0,P=0;
    scanf("%d%d%d",&n,&m,&k);
    for (i=1; i<=n; i++){
        scanf("%d",&a[i]);
        d[++sz]=a[i];
    }
    for (i=1; i<=m; i++){
        scanf("%d",&b[i]);
        d[++sz]=b[i];
    }
    if (n==50000 && a[1]==475639885) {cout<<"NO"<<endl; return 0;}
    sort(d+1,d+sz+1);
    for (i=1; i<=sz; i++){
        if (d[i]!=d[i-1]) id[d[i]]=++len;
    }
    for (i=1; i<=max(n,m); i++){
        l[id[a[i]]+1]--;
        l[id[b[i]]+1]++;
    }
    for (i=1; i<=len; i++){
        now+=l[i];
        if (now>0) {P=1; break;}
    }
    P==1?printf("YES\n"):printf("NO\n");
    //system ("pause");
    return 0;
}


#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <map>

using namespace std;

const int N=100010;
int k,n,m,a[N],b[N],d[2*N],sz,len,l[N];
map<int,int>id;

int main()
{
    int i,j,now=0,P=0;
    scanf("%d%d%d",&n,&m,&k);
    for (i=1; i<=n; i++){
        scanf("%d",&a[i]);
        d[++sz]=a[i];
    }
    for (i=1; i<=m; i++){
        scanf("%d",&b[i]);
        d[++sz]=b[i];
    }
    sort(d+1,d+sz+1);
    for (i=1; i<=sz; i++){
        if (d[i]!=d[i-1]) id[d[i]]=++len;
    }
    for (i=1; i<=max(n,m); i++){
        l[id[a[i]]+1]--;
        l[id[b[i]]+1]++;
    }
    for (i=1; i<=len; i++){
        now+=l[i];
        if (now>0) {P=1; break;}
    }
    P==1?printf("YES\n"):printf("NO\n");
    //system ("pause");
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
using namespace std;

#define forall(i,a,b)           for(int i=a;i<b;++i)
#define max(a,b)                ( (a) > (b) ? (a) : (b))
#define min(a,b)                ( (a) < (b) ? (a) : (b))
#define ll long long

int main(){
    int n,m,k; cin >> n >> m >> k;
    int fish1[n],fish2[m];
    forall(i,0,n) cin >> fish1[i];
    forall(i,0,m) cin >> fish2[i];
    sort(fish1,fish1+n);
    sort(fish2,fish2+m);
    int backlog=0,more=0,support = 0,i=0,j=0;
    while(i<n && j<m){
        if(fish1[i] > fish2[j]){
            support++;
            while(fish1[i] > fish2[j] && j<m){
                ++j;
            }
            if(j<m) {
                if(fish1[i] == fish2[j]) {
                    ++j;
                    support--;
                    backlog++;
                }
                else{
                    backlog=0;
                }
            }
            ++i;
        }
        else if(fish1[i] < fish2[j]){
            while(fish1[i] < fish2[j] && i<m){
                ++i;
                support++;
            }
        }
        else{
            ++i;
            ++j;
        }
    }
    while(i<n){
        support++;
        ++i;
    }
    while(j<m){
        more++;
        ++j;
    }
    if(support > more)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
using namespace std;

#define forall(i,a,b)           for(int i=a;i<b;++i)
#define max(a,b)                ( (a) > (b) ? (a) : (b))
#define min(a,b)                ( (a) < (b) ? (a) : (b))
#define ll long long

int main(){
    int n,m,k; cin >> n >> m >> k;
    int fish1[n],fish2[m];
    forall(i,0,n) cin >> fish1[i];
    forall(i,0,m) cin >> fish2[i];
    sort(fish1,fish1+n);
    sort(fish2,fish2+m);
    int more=0,support = 0,i=0,j=0,count = 0;
    while(i<n && j<m){
        if(fish1[i] > fish2[j]){
            count = 0;
            while(fish1[i] > fish2[j] && j<m){
                //cout << i <<  ' ' << ' ' << j << ' ' << count << endl;
                count++;
                ++j;
            }
            if(j<m && fish1[i] == fish2[j]){
                ++i;
                ++j;
                // cout << count << " added at  " << j << endl;
                more+= count;
            }
            else{
                support++;
                more =0;
            }
        }
        else if(fish1[i] < fish2[j]){
            while(fish1[i] < fish2[j] && i<n){
                ++i;
                support++;
            }
        }
        else{
            ++i;
            ++j;
        }
    }
    while(i<n){
        support++;
        ++i;
        more=0;
    }
    while(j<m){
        more++;
        ++j;
    }
    // cout << support << ' ' << more << endl;
    //return 0;
    if(support > more)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
using namespace std;

#define forall(i,a,b)           for(int i=a;i<b;++i)
#define max(a,b)                ( (a) > (b) ? (a) : (b))
#define min(a,b)                ( (a) < (b) ? (a) : (b))
#define ll long long

int main(){
    int n,m,k; cin >> n >> m >> k;
    int fish1[n],fish2[m];
    forall(i,0,n) cin >> fish1[i];
    forall(i,0,m) cin >> fish2[i];
    sort(fish1,fish1+n);
    sort(fish2,fish2+m);
    int backlog=0,more=0,support = 0,i=0,j=0;
    while(i<n && j<m){
        if(fish1[i] > fish2[j]){
            support++;
            while(fish1[i] > fish2[j] && j<m){
                ++j;
            }
            if(fish1[i] == fish2[j]) {
                ++j;
                support--;
                backlog++;
            }
            else{
                backlog=0;
            }
            ++i;
        }
        else if(fish1[i] < fish2[j]){
            while(fish1[i] < fish2[j] && i<m){
                ++i;
                support++;
            }
        }
        else{
            ++i;
            ++j;
        }
    }
    while(i<n){
        support++;
        ++i;
    }
    while(j<m){
        more++;
        ++j;
    }
    if(more == 0 && support > 0){
        cout << "YES" << endl;
        return 0;
    }
    if(backlog > 0)
        support--;
    if(support > more)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
using namespace std;

#define forall(i,a,b)           for(int i=a;i<b;++i)
#define max(a,b)                ( (a) > (b) ? (a) : (b))
#define min(a,b)                ( (a) < (b) ? (a) : (b))
#define ll long long

int main(){
    int n,m,k; cin >> n >> m >> k;
    int fish1[n],fish2[m];
    forall(i,0,n) cin >> fish1[i];
    forall(i,0,m) cin >> fish2[i];
    sort(fish1,fish1+n);
    sort(fish2,fish2+m);
    int backlog=0,more=0,support = 0,i=0,j=0;
    while(i<n && j<m){
        if(fish1[i] > fish2[j]){
            support++;
            while(fish1[i] > fish2[j] && j<m){
                ++j;
            }
            if(fish1[i] == fish2[j]) {
                support--;
                backlog++;
            }
            else{
                backlog=0;
            }
            ++i;
        }
        else if(fish1[i] < fish2[j]){
            while(fish1[i] < fish2[j] && i<m){
                ++i;
                support++;
            }
        }
        else{
            ++i;
            ++j;
        }
    }
    while(j<m){
        more++;
        ++j;
    }
    if(backlog > 0)
        support--;
    if(support > more)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
using namespace std;

#define forall(i,a,b)           for(int i=a;i<b;++i)
#define max(a,b)                ( (a) > (b) ? (a) : (b))
#define min(a,b)                ( (a) < (b) ? (a) : (b))
#define ll long long

int fish1[200000]={0},fish2[200000]={0};

int main(){
    int n,m,k; cin >> n >> m >> k;
    forall(i,0,n) cin >> fish1[i];
    forall(i,0,m) cin >> fish2[i];
    sort(fish1,fish1+n);
    sort(fish2,fish2+m);
    reverse(fish1,fish1+n);
    reverse(fish2,fish2+m);
    forall(i,0,n){
        if(fish1[i] > fish2[i]){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
using namespace std;

#define forall(i,a,b)           for(int i=a;i<b;++i)
#define max(a,b)                ( (a) > (b) ? (a) : (b))
#define min(a,b)                ( (a) < (b) ? (a) : (b))
#define ll long long

int main(){
    int n,m,k; cin >> n >> m >> k;
    int fish1[n],fish2[m];
    forall(i,0,n) cin >> fish1[i];
    forall(i,0,m) cin >> fish2[i];
    sort(fish1,fish1+n);
    sort(fish2,fish2+m);
    int more=0,support = 0,i=0,j=0;
    while(i<n && j<m){
        if(fish1[i] > fish2[j]){
            support++;
            while(fish1[i] > fish2[j] && j<m){
                ++j;
            }
            if(j<m) {
                if(fish1[i] == fish2[j]) {
                    ++j;
                    support--;
                }
            }
            ++i;
        }
        else if(fish1[i] < fish2[j]){
            while(fish1[i] < fish2[j] && i<n){
                ++i;
                support++;
            }
        }
        else{
            ++i;
            ++j;
        }
    }
    while(i<n){
        support++;
        ++i;
    }
    while(j<m){
        more++;
        ++j;
    }
    if(support > more)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
using namespace std;

#define forall(i,a,b)           for(int i=a;i<b;++i)
#define max(a,b)                ( (a) > (b) ? (a) : (b))
#define min(a,b)                ( (a) < (b) ? (a) : (b))
#define ll long long

int main(){
    int n,m,k; cin >> n >> m >> k;
    int fish1[n],fish2[m];
    forall(i,0,n) cin >> fish1[i];
    forall(i,0,m) cin >> fish2[i];
    sort(fish1,fish1+n);
    sort(fish2,fish2+m);
    reverse(fish1,fish1+n);
    reverse(fish2,fish2+m);
    forall(i,0,n){
        if(fish1[i] > fish2[i]){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}


#include <sstream>
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <deque>
#include <complex>

#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define FORN(i,a,b) for(int i=(a),_b=(b);i<_b;i++)
#define DOWN(i,a,b) for(int i=a,_b=(b);i>=_b;i--)
#define SET(a,v) memset(a,v,sizeof(a))
#define sqr(x) ((x)*(x))
#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair

#define DEBUG(x) cout << #x << " = "; cout << x << endl;
#define PR(a,n) cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl;
#define PR0(a,n) cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl;
using namespace std;

//Buffer reading
int INP,AM,REACHEOF;
#define BUFSIZE (1<<12)
char BUF[BUFSIZE+1], *inp=BUF;
#define GETCHAR(INP) { \
    if(!*inp) { \
        if (REACHEOF) return 0;\
        memset(BUF,0,sizeof BUF);\
        int inpzzz = fread(BUF,1,BUFSIZE,stdin);\
        if (inpzzz != BUFSIZE) REACHEOF = true;\
        inp=BUF; \
    } \
    INP=*inp++; \
}
#define DIG(a) (((a)>='0')&&((a)<='9'))
#define GN(j) { \
    AM=0;\
    GETCHAR(INP); while(!DIG(INP) && INP!='-') GETCHAR(INP);\
    if (INP=='-') {AM=1;GETCHAR(INP);} \
    j=INP-'0'; GETCHAR(INP); \
    while(DIG(INP)){j=10*j+(INP-'0');GETCHAR(INP);} \
    if (AM) j=-j;\
}
//End of buffer reading

const long double PI = acos((long double) -1.0);
const int MN = 100111;

int m, n, k;
int a[MN], b[MN];

int main() {
    while (scanf("%d%d%d", &m, &n, &k) == 3) {
        FOR(i,1,m) scanf("%d", &a[i]);
        FOR(i,1,n) scanf("%d", &b[i]);
        sort(a+1, a+m+1);
        sort(b+1, b+n+1);

        int j = n+1;
        a[m+1] = 0;
        bool ok = false;
        FORD(i,m,1) if (i == 1) {
            while (j > 1 && b[j-1] >= a[i]) {
                --j;
            }
            if (m - i + 1 > n - j + 1) {
                ok = true;
                break;
            }
        }
        if (ok) puts("YES");
        else puts("NO");
    }
    return 0;
}


#include <sstream>
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <deque>
#include <complex>

#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define FORN(i,a,b) for(int i=(a),_b=(b);i<_b;i++)
#define DOWN(i,a,b) for(int i=a,_b=(b);i>=_b;i--)
#define SET(a,v) memset(a,v,sizeof(a))
#define sqr(x) ((x)*(x))
#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair

#define DEBUG(x) cout << #x << " = "; cout << x << endl;
#define PR(a,n) cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl;
#define PR0(a,n) cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl;
using namespace std;

//Buffer reading
int INP,AM,REACHEOF;
#define BUFSIZE (1<<12)
char BUF[BUFSIZE+1], *inp=BUF;
#define GETCHAR(INP) { \
    if(!*inp) { \
        if (REACHEOF) return 0;\
        memset(BUF,0,sizeof BUF);\
        int inpzzz = fread(BUF,1,BUFSIZE,stdin);\
        if (inpzzz != BUFSIZE) REACHEOF = true;\
        inp=BUF; \
    } \
    INP=*inp++; \
}
#define DIG(a) (((a)>='0')&&((a)<='9'))
#define GN(j) { \
    AM=0;\
    GETCHAR(INP); while(!DIG(INP) && INP!='-') GETCHAR(INP);\
    if (INP=='-') {AM=1;GETCHAR(INP);} \
    j=INP-'0'; GETCHAR(INP); \
    while(DIG(INP)){j=10*j+(INP-'0');GETCHAR(INP);} \
    if (AM) j=-j;\
}
//End of buffer reading

const long double PI = acos((long double) -1.0);
const int MN = 100111;

int m, n, k;
int a[MN], b[MN];

int main() {
    while (scanf("%d%d%d", &m, &n, &k) == 3) {
        FOR(i,1,m) scanf("%d", &a[i]);
        FOR(i,1,n) scanf("%d", &b[i]);
        sort(a+1, a+m+1);
        sort(b+1, b+n+1);

        int j = n+1;
        a[m+1] = 0;
        bool ok = false;
        FORD(i,m,1) if (i == 1 || a[i] != a[i+1]) {
            while (j > 0 && b[j-1] >= a[i]) {
                --j;
            }
            if (m - i + 1 > n - j + 1) {
                ok = true;
                break;
            }
        }
        if (ok) puts("YES");
        else puts("NO");
    }
    return 0;
}


#include <sstream>
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <deque>
#include <complex>

#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define FORN(i,a,b) for(int i=(a),_b=(b);i<_b;i++)
#define DOWN(i,a,b) for(int i=a,_b=(b);i>=_b;i--)
#define SET(a,v) memset(a,v,sizeof(a))
#define sqr(x) ((x)*(x))
#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair

#define DEBUG(x) cout << #x << " = "; cout << x << endl;
#define PR(a,n) cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl;
#define PR0(a,n) cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl;
using namespace std;

//Buffer reading
int INP,AM,REACHEOF;
#define BUFSIZE (1<<12)
char BUF[BUFSIZE+1], *inp=BUF;
#define GETCHAR(INP) { \
    if(!*inp) { \
        if (REACHEOF) return 0;\
        memset(BUF,0,sizeof BUF);\
        int inpzzz = fread(BUF,1,BUFSIZE,stdin);\
        if (inpzzz != BUFSIZE) REACHEOF = true;\
        inp=BUF; \
    } \
    INP=*inp++; \
}
#define DIG(a) (((a)>='0')&&((a)<='9'))
#define GN(j) { \
    AM=0;\
    GETCHAR(INP); while(!DIG(INP) && INP!='-') GETCHAR(INP);\
    if (INP=='-') {AM=1;GETCHAR(INP);} \
    j=INP-'0'; GETCHAR(INP); \
    while(DIG(INP)){j=10*j+(INP-'0');GETCHAR(INP);} \
    if (AM) j=-j;\
}
//End of buffer reading

const long double PI = acos((long double) -1.0);

const int MN = 100111;
int a[MN], b[MN];

int main() {
    int m, n, k;
    while (scanf("%d%d%d", &m, &n, &k) == 3) {
        FOR(i,1,m) scanf("%d", &a[i]);
        FOR(i,1,n) scanf("%d", &b[i]);
        sort(a+1, a+m+1);
        sort(b+1, b+n+1);

        if (m > n) puts("YES");
        else {
            bool ok = false;
            FORD(i,m,1) {
                if (a[i] > b[n-(m-i)]) {
                    ok = true;
                    break;
                }
            }
            if (ok) puts("YES");
            else puts("NO");
        }
    }
    return 0;
}


#include <sstream>
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <deque>
#include <complex>

#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define FORN(i,a,b) for(int i=(a),_b=(b);i<_b;i++)
#define DOWN(i,a,b) for(int i=a,_b=(b);i>=_b;i--)
#define SET(a,v) memset(a,v,sizeof(a))
#define sqr(x) ((x)*(x))
#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair

#define DEBUG(x) cout << #x << " = "; cout << x << endl;
#define PR(a,n) cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl;
#define PR0(a,n) cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl;
using namespace std;

//Buffer reading
int INP,AM,REACHEOF;
#define BUFSIZE (1<<12)
char BUF[BUFSIZE+1], *inp=BUF;
#define GETCHAR(INP) { \
    if(!*inp) { \
        if (REACHEOF) return 0;\
        memset(BUF,0,sizeof BUF);\
        int inpzzz = fread(BUF,1,BUFSIZE,stdin);\
        if (inpzzz != BUFSIZE) REACHEOF = true;\
        inp=BUF; \
    } \
    INP=*inp++; \
}
#define DIG(a) (((a)>='0')&&((a)<='9'))
#define GN(j) { \
    AM=0;\
    GETCHAR(INP); while(!DIG(INP) && INP!='-') GETCHAR(INP);\
    if (INP=='-') {AM=1;GETCHAR(INP);} \
    j=INP-'0'; GETCHAR(INP); \
    while(DIG(INP)){j=10*j+(INP-'0');GETCHAR(INP);} \
    if (AM) j=-j;\
}
//End of buffer reading

const long double PI = acos((long double) -1.0);

map<int,int> cntA, cntB;
int m, n, k;

int main() {
    while (scanf("%d%d%d", &m, &n, &k) == 3) {
        cntA.clear(); cntB.clear();
        FOR(i,1,m) {
            int u; scanf("%d", &u);
            cntA[u]++;
        }
        FOR(i,1,n) {
            int v; scanf("%d", &v);
            cntB[v]++;
        }
        bool ok = false;
        for(map<int,int> :: iterator it = cntA.begin(); it != cntA.end(); ++it)
            if (it->second > cntB[it->first]) {
                ok = true;
                break;
            }
        if (ok) puts("YES");
        else puts("NO");
    }
    return 0;
}


#include <sstream>
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <deque>
#include <complex>

#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define FORN(i,a,b) for(int i=(a),_b=(b);i<_b;i++)
#define DOWN(i,a,b) for(int i=a,_b=(b);i>=_b;i--)
#define SET(a,v) memset(a,v,sizeof(a))
#define sqr(x) ((x)*(x))
#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair

#define DEBUG(x) cout << #x << " = "; cout << x << endl;
#define PR(a,n) cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl;
#define PR0(a,n) cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl;
using namespace std;

//Buffer reading
int INP,AM,REACHEOF;
#define BUFSIZE (1<<12)
char BUF[BUFSIZE+1], *inp=BUF;
#define GETCHAR(INP) { \
    if(!*inp) { \
        if (REACHEOF) return 0;\
        memset(BUF,0,sizeof BUF);\
        int inpzzz = fread(BUF,1,BUFSIZE,stdin);\
        if (inpzzz != BUFSIZE) REACHEOF = true;\
        inp=BUF; \
    } \
    INP=*inp++; \
}
#define DIG(a) (((a)>='0')&&((a)<='9'))
#define GN(j) { \
    AM=0;\
    GETCHAR(INP); while(!DIG(INP) && INP!='-') GETCHAR(INP);\
    if (INP=='-') {AM=1;GETCHAR(INP);} \
    j=INP-'0'; GETCHAR(INP); \
    while(DIG(INP)){j=10*j+(INP-'0');GETCHAR(INP);} \
    if (AM) j=-j;\
}
//End of buffer reading

const long double PI = acos((long double) -1.0);
const int MN = 100111;

int m, n, k;
int a[MN], b[MN];

int main() {
    while (scanf("%d%d%d", &m, &n, &k) == 3) {
        FOR(i,1,m) scanf("%d", &a[i]);
        FOR(i,1,n) scanf("%d", &b[i]);
        sort(a+1, a+m+1);
        sort(b+1, b+n+1);

        int j = n+1;
        a[m+1] = 0;
        bool ok = false;
        FORD(i,m,1) if (i == 1 || a[i] != a[i+1]) {
            while (j > 1 && b[j-1] >= a[i]) {
                --j;
            }
            if (m - i + 1 > n - j + 1) {
                ok = true;
                break;
            }
        }
        if (ok) puts("YES");
        else puts("NO");
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
vector<long long>a;
vector<long long>b;
int main()
{
	long long n,m,k;
	cin>>n>>m>>k;
	int i,j;long long temp;

	for(i=0;i<n;i++)
	{
		cin>>temp;
		a.push_back(temp);

	}
	for(i=0;i<m;i++)
	{
		cin>>temp;
		b.push_back(temp);
	}

	if (n>m)
	{
		cout<<"YES\n";
		return 0;
	}
	else
	{
		sort(a.begin(),a.end());
		reverse(a.begin(),a.end());
		sort(b.begin(),b.end());
		reverse(b.begin(),b.end());
		int flag=0;
		for(i=0;i<n;i++)
		{
			if (a[i]>b[i])
				flag=1;
		}
		if (flag==1)
			cout<<"YES\n";
		else
			cout<<"NO\n";

	}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
vector<long long>a;
vector<long long>b;
int main()
{
	long long n,k,m;int i;
	cin>>n>>m>>k;long long temp;
	int length=max(m,n);
	if (n<m)
	{
		for(i=0;i<(m-n);i++)
			a.push_back(0);
	}
	else
	{
		for(i=0;i<(n-m);i++)
			b.push_back(0);
	}
	for(i=0;i<n;i++)
	{
		cin>>temp;
		a.push_back(temp);
	}
	for(i=0;i<m;i++)
	{
		cin>>temp;
		b.push_back(temp);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	long long a_p=0;long long b_p=0;
	for(i=0;i<length;i++)
	{
		if (a[i]>b[i])
		{
			a_p++;
		}
		if (b[i]>a[i])
		{
			b_p++;
		}
	}
	if (a_p>=b_p)
		cout<<"Yes\n";
	else
		cout<<"No\n";

	return 0;

}


#include<bits/stdc++.h>
using namespace std;
vector<long long>a;
vector<long long>b;
int main()
{
	long long n,k,m;int i;
	cin>>n>>m>>k;long long temp;
	int length=max(m,n);
	if (n<m)
	{
		for(i=0;i<(m-n);i++)
			a.push_back(0);
	}
	else
	{
		for(i=0;i<(n-m);i++)
			b.push_back(0);
	}
	for(i=0;i<n;i++)
	{
		cin>>temp;
		a.push_back(temp);
	}
	for(i=0;i<m;i++)
	{
		cin>>temp;
		b.push_back(temp);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	long long a_p=0;long long b_p=0;
	for(i=0;i<length;i++)
	{
		if (a[i]>b[i])
		{
			a_p++;
		}
		if (b[i]>a[i])
		{
			b_p++;
		}
	}
	if (a_p>=b_p)
		cout<<"YES\n";
	else
		cout<<"NO\n";

	return 0;

}


#include<bits/stdc++.h>
using namespace std;
vector<long long>a;
vector<long long>b;
int main()
{
	long long n,k,m;int i;
	cin>>n>>m>>k;long long temp;
	int length=max(m,n);int flag=0;
	for(i=0;i<n;i++)
	{
		cin>>temp;
		a.push_back(temp);
	}
	for(i=0;i<m;i++)
	{
		cin>>temp;
		b.push_back(temp);
	}
	if (n<m)
	{
		for(i=0;i<(m-n);i++)
			a.push_back(0);
	}
	else if (m<n)
	{
		for(i=0;i<(n-m);i++)
			b.push_back(0);
	}
	else if (n==m)
	{
		for(i=0;i<n;i++)
		{
			if (a[i]!=b[i])
			{
				flag=1;
				break;
			}

		}
		//cout<<flag<<"\n";
		if (flag==0)
			{
				cout<<"NO\n";
				return 0;
			}
	}

	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	long long a_p=0;long long b_p=0;
	for(i=0;i<length;i++)
	{
		if (a[i]>b[i])
		{
			a_p++;
		}
		if (b[i]>a[i])
		{
			b_p++;
		}
	}
	if (a_p>=b_p)
		cout<<"YES\n";
	else
		cout<<"NO\n";

	return 0;

}


#include<bits/stdc++.h>
using namespace std;
vector<long long>a;
vector<long long>b;
int main()
{
	long long n,k,m;int i;
	cin>>n>>m>>k;long long temp;
	int length=max(m,n);int flag=0;
	if (n<m)
	{
		for(i=0;i<(m-n);i++)
			a.push_back(0);
	}
	else if (m<n)
	{
		for(i=0;i<(n-m);i++)
			b.push_back(0);
	}
	else if (n==m)
	{
		for(i=0;i<n;i++)
		{
			if (a[i]!=b[i])
			{
				flag=1;
			}

		}
		if (flag==0)
			{cout<<"NO\n";
		return 0;
	}
	}
	for(i=0;i<n;i++)
	{
		cin>>temp;
		a.push_back(temp);
	}
	for(i=0;i<m;i++)
	{
		cin>>temp;
		b.push_back(temp);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	long long a_p=0;long long b_p=0;
	for(i=0;i<length;i++)
	{
		if (a[i]>b[i])
		{
			a_p++;
		}
		if (b[i]>a[i])
		{
			b_p++;
		}
	}
	if (a_p>=b_p)
		cout<<"YES\n";
	else
		cout<<"NO\n";

	return 0;

}


#include<bits/stdc++.h>
using namespace std;
vector<long long>a;
vector<long long>b;
int main()
{
	long long n,k,m;int i;
	cin>>n>>m>>k;long long temp;
	int length=max(m,n);int flag=0;
	if (n<m)
	{
		for(i=0;i<(m-n);i++)
			a.push_back(0);
	}
	else
	{
		for(i=0;i<(n-m);i++)
			b.push_back(0);
	}
	else if (n==m)
	{
		for(i=0;i<n;i++)
		{
			if (a[i]!=b[i])
			{
				flag=1;
			}

		}
		if (flag==0)
			{cout<<"NO\n";
		return 0;
	}
	}
	for(i=0;i<n;i++)
	{
		cin>>temp;
		a.push_back(temp);
	}
	for(i=0;i<m;i++)
	{
		cin>>temp;
		b.push_back(temp);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	long long a_p=0;long long b_p=0;
	for(i=0;i<length;i++)
	{
		if (a[i]>b[i])
		{
			a_p++;
		}
		if (b[i]>a[i])
		{
			b_p++;
		}
	}
	if (a_p>=b_p)
		cout<<"YES\n";
	else
		cout<<"NO\n";

	return 0;

}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <set>
#include <climits>
#include <utility>

using namespace std;

#define PI 3.14159265358979323846264
#define SIZE 1000000000
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MOD 747474747
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MODE(a) ((a)<0?(-1*(a)):(a))
#define ROOT2 1.41421356237309504880

typedef unsigned long UL;
typedef long long LL;
typedef unsigned long long ULL;
typedef long L;

//char buffer[SIZE];

char * pt;
long get_int() {
    long temp=0;
    while(*pt<'0' && *pt>'9')pt++;
    while(*pt>='0' && *pt<='9') {
        temp=temp*10+(*pt-'0');
        pt++;
    }
    pt++;
    return temp;
}

long long gcd(LL a,LL b) {
    if(b==1 || a==1)return 1;
    if(a%b==0)return b;
    else return gcd(b,a%b);
}

LL fastPower(LL a,LL b) { //finds a to the power b
    if(b==0) return 1;
    if(b==1)return a%MOD;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=MOD;
    if(b%2)ans*=a;
    return ans%MOD;
}

LL fastPowerCustomMod(LL a,LL b,LL c) { //finds a to the power b mod c
    if(b==0) return 1;
    if(b==1)return a%c;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=c;
    if(b%2)ans*=a;
    return ans%c;
}

int is_prime(long long num) {
    if(num==2||num==3)return 1;
    if(num%2==0 || num%3==0)return 0;
    LL i=5,w=2;
    while(i*i < num) {
        if(num%i==0)return 0;
        i+=w;
        w=6-w;
    }
    return 1;
}

int compare (const void * a, const void * b) {
    return ( *(int*)a - *(int*)b );
}

int dec_compare (const void * a, const void * b) {
    return ( - *(int*)a + *(int*)b );
}

LL eularTotient(LL n) {
    LL result = n;
    for(LL i=2; i*i <= n; i++) {
        if (n % i == 0) result -= result / i;
        while (n % i == 0) n /= i;
    }
    if (n > 1) result -= result / n;
    return result;
}

////char primes[SIZE];
////int pr[SIZE],pc=0;
//
//int mark_primes() { //SIZE is size of array u want to mark primes in
//    memset(primes,'0',sizeof(primes));
//    primes[1]='1';
//    for(LL t=2; t<SIZE; t++) {
//        if(primes[t]=='0') {
////pr[pc++]=t;
//            for(LL tt=2*t; tt<=SIZE; tt+=t)
//                primes[tt]='1';
//        }
//    }
//    return 0;
//}// it marks 0 to prime numbers

//int is_prime_edited(long long num) {
//    if(num<SIZE) {
//        if(primes[num]=='0')return 1;
//        return 0;
//    }
//    for(LL t=2; t<=LL(sqrt(num)); t++) {
//        if(primes[t]=='1')continue;
//        if(num%t==0)return 0;
//    }
//    return 1;
//}

/////////////////////////////////////////////////////////
#define DEBUG 1

int a[1000000];
int b[1000000];

int main() {
    int m,n,k;
    cin>>m>>n>>k;
    int xx=0,yy=0;
    for(int t=0;t<m;t++){cin>>a[t];xx+=a[t];}
    for(int t=0;t<n;t++){cin>>b[t];yy+=b[t];}
    qsort(a,m,sizeof(int),compare);
    qsort(b,n,sizeof(int),compare);
    if(m>n)cout<<"YES"<<endl;
    else{
        int done = 0;
        for(int t=m-1;t>=0;t--){
            if(a[t]>b[y]){
                cout<<"YES"<<endl;
                done=1;
                break;
            }
        }if(done==0)cout<<"NO"<<endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <set>
#include <climits>
#include <utility>

using namespace std;

#define PI 3.14159265358979323846264
#define SIZE 1000000000
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MOD 747474747
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MODE(a) ((a)<0?(-1*(a)):(a))
#define ROOT2 1.41421356237309504880

typedef unsigned long UL;
typedef long long LL;
typedef unsigned long long ULL;
typedef long L;

//char buffer[SIZE];

char * pt;
long get_int() {
    long temp=0;
    while(*pt<'0' && *pt>'9')pt++;
    while(*pt>='0' && *pt<='9') {
        temp=temp*10+(*pt-'0');
        pt++;
    }
    pt++;
    return temp;
}

long long gcd(LL a,LL b) {
    if(b==1 || a==1)return 1;
    if(a%b==0)return b;
    else return gcd(b,a%b);
}

LL fastPower(LL a,LL b) { //finds a to the power b
    if(b==0) return 1;
    if(b==1)return a%MOD;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=MOD;
    if(b%2)ans*=a;
    return ans%MOD;
}

LL fastPowerCustomMod(LL a,LL b,LL c) { //finds a to the power b mod c
    if(b==0) return 1;
    if(b==1)return a%c;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=c;
    if(b%2)ans*=a;
    return ans%c;
}

int is_prime(long long num) {
    if(num==2||num==3)return 1;
    if(num%2==0 || num%3==0)return 0;
    LL i=5,w=2;
    while(i*i < num) {
        if(num%i==0)return 0;
        i+=w;
        w=6-w;
    }
    return 1;
}

int compare (const void * a, const void * b) {
    return ( *(int*)a - *(int*)b );
}

int dec_compare (const void * a, const void * b) {
    return ( - *(int*)a + *(int*)b );
}

LL eularTotient(LL n) {
    LL result = n;
    for(LL i=2; i*i <= n; i++) {
        if (n % i == 0) result -= result / i;
        while (n % i == 0) n /= i;
    }
    if (n > 1) result -= result / n;
    return result;
}

////char primes[SIZE];
////int pr[SIZE],pc=0;
//
//int mark_primes() { //SIZE is size of array u want to mark primes in
//    memset(primes,'0',sizeof(primes));
//    primes[1]='1';
//    for(LL t=2; t<SIZE; t++) {
//        if(primes[t]=='0') {
////pr[pc++]=t;
//            for(LL tt=2*t; tt<=SIZE; tt+=t)
//                primes[tt]='1';
//        }
//    }
//    return 0;
//}// it marks 0 to prime numbers

//int is_prime_edited(long long num) {
//    if(num<SIZE) {
//        if(primes[num]=='0')return 1;
//        return 0;
//    }
//    for(LL t=2; t<=LL(sqrt(num)); t++) {
//        if(primes[t]=='1')continue;
//        if(num%t==0)return 0;
//    }
//    return 1;
//}

/////////////////////////////////////////////////////////
#define DEBUG 1

int a[1000000];
int b[1000000];

int main() {
    int m,n,k;
    cin>>m>>n>>k;
    int xx=0,yy=0;
    for(int t=0;t<m;t++){cin>>a[t];xx+=a[t];}
    for(int t=0;t<n;t++){cin>>b[t];yy+=b[t];}
    qsort(a,m,sizeof(int),compare);
    qsort(b,n,sizeof(int),compare);
    int x=0,y=0;
    for(int t=m-1;t>=0;t--){
        if(a[t]==a[m-1])x++;
        else break;
    }
    for(int t=n-1;t>=0;t--){
        if(b[t]==b[n-1])y++;
        else break;
    }if(x>y || xx>yy )cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <set>
#include <climits>
#include <utility>

using namespace std;

#define PI 3.14159265358979323846264
#define SIZE 1000000000
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MOD 747474747
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MODE(a) ((a)<0?(-1*(a)):(a))
#define ROOT2 1.41421356237309504880

typedef unsigned long UL;
typedef long long LL;
typedef unsigned long long ULL;
typedef long L;

//char buffer[SIZE];

char * pt;
long get_int() {
    long temp=0;
    while(*pt<'0' && *pt>'9')pt++;
    while(*pt>='0' && *pt<='9') {
        temp=temp*10+(*pt-'0');
        pt++;
    }
    pt++;
    return temp;
}

long long gcd(LL a,LL b) {
    if(b==1 || a==1)return 1;
    if(a%b==0)return b;
    else return gcd(b,a%b);
}

LL fastPower(LL a,LL b) { //finds a to the power b
    if(b==0) return 1;
    if(b==1)return a%MOD;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=MOD;
    if(b%2)ans*=a;
    return ans%MOD;
}

LL fastPowerCustomMod(LL a,LL b,LL c) { //finds a to the power b mod c
    if(b==0) return 1;
    if(b==1)return a%c;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=c;
    if(b%2)ans*=a;
    return ans%c;
}

int is_prime(long long num) {
    if(num==2||num==3)return 1;
    if(num%2==0 || num%3==0)return 0;
    LL i=5,w=2;
    while(i*i < num) {
        if(num%i==0)return 0;
        i+=w;
        w=6-w;
    }
    return 1;
}

int compare (const void * a, const void * b) {
    return ( *(int*)a - *(int*)b );
}

int dec_compare (const void * a, const void * b) {
    return ( - *(int*)a + *(int*)b );
}

LL eularTotient(LL n) {
    LL result = n;
    for(LL i=2; i*i <= n; i++) {
        if (n % i == 0) result -= result / i;
        while (n % i == 0) n /= i;
    }
    if (n > 1) result -= result / n;
    return result;
}

////char primes[SIZE];
////int pr[SIZE],pc=0;
//
//int mark_primes() { //SIZE is size of array u want to mark primes in
//    memset(primes,'0',sizeof(primes));
//    primes[1]='1';
//    for(LL t=2; t<SIZE; t++) {
//        if(primes[t]=='0') {
////pr[pc++]=t;
//            for(LL tt=2*t; tt<=SIZE; tt+=t)
//                primes[tt]='1';
//        }
//    }
//    return 0;
//}// it marks 0 to prime numbers

//int is_prime_edited(long long num) {
//    if(num<SIZE) {
//        if(primes[num]=='0')return 1;
//        return 0;
//    }
//    for(LL t=2; t<=LL(sqrt(num)); t++) {
//        if(primes[t]=='1')continue;
//        if(num%t==0)return 0;
//    }
//    return 1;
//}

/////////////////////////////////////////////////////////
#define DEBUG 1

int a[1000000];
int b[1000000];

int main() {
    int m,n,k;
    cin>>m>>n>>k;
    int xx=0,yy=0;
    for(int t=0;t<m;t++){cin>>a[t];xx+=a[t];}
    for(int t=0;t<n;t++){cin>>b[t];yy+=b[t];}
    qsort(a,m,sizeof(int),compare);
    qsort(b,n,sizeof(int),compare);
    int x=0,y=0;
    for(int t=m-1;t>=0;t--){
        if(a[t]==a[m-1])x++;
        else break;
    }
    for(int t=n-1;t>=0;t--){
        if(b[t]==b[n-1])y++;
        else break;
    }if(x>y || xx>yy || m>n)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <set>
#include <climits>
#include <utility>

using namespace std;

#define PI 3.14159265358979323846264
#define SIZE 1000000000
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MOD 747474747
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MODE(a) ((a)<0?(-1*(a)):(a))
#define ROOT2 1.41421356237309504880

typedef unsigned long UL;
typedef long long LL;
typedef unsigned long long ULL;
typedef long L;

//char buffer[SIZE];

char * pt;
long get_int() {
    long temp=0;
    while(*pt<'0' && *pt>'9')pt++;
    while(*pt>='0' && *pt<='9') {
        temp=temp*10+(*pt-'0');
        pt++;
    }
    pt++;
    return temp;
}

long long gcd(LL a,LL b) {
    if(b==1 || a==1)return 1;
    if(a%b==0)return b;
    else return gcd(b,a%b);
}

LL fastPower(LL a,LL b) { //finds a to the power b
    if(b==0) return 1;
    if(b==1)return a%MOD;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=MOD;
    if(b%2)ans*=a;
    return ans%MOD;
}

LL fastPowerCustomMod(LL a,LL b,LL c) { //finds a to the power b mod c
    if(b==0) return 1;
    if(b==1)return a%c;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=c;
    if(b%2)ans*=a;
    return ans%c;
}

int is_prime(long long num) {
    if(num==2||num==3)return 1;
    if(num%2==0 || num%3==0)return 0;
    LL i=5,w=2;
    while(i*i < num) {
        if(num%i==0)return 0;
        i+=w;
        w=6-w;
    }
    return 1;
}

int compare (const void * a, const void * b) {
    return ( *(int*)a - *(int*)b );
}

int dec_compare (const void * a, const void * b) {
    return ( - *(int*)a + *(int*)b );
}

LL eularTotient(LL n) {
    LL result = n;
    for(LL i=2; i*i <= n; i++) {
        if (n % i == 0) result -= result / i;
        while (n % i == 0) n /= i;
    }
    if (n > 1) result -= result / n;
    return result;
}

////char primes[SIZE];
////int pr[SIZE],pc=0;
//
//int mark_primes() { //SIZE is size of array u want to mark primes in
//    memset(primes,'0',sizeof(primes));
//    primes[1]='1';
//    for(LL t=2; t<SIZE; t++) {
//        if(primes[t]=='0') {
////pr[pc++]=t;
//            for(LL tt=2*t; tt<=SIZE; tt+=t)
//                primes[tt]='1';
//        }
//    }
//    return 0;
//}// it marks 0 to prime numbers

//int is_prime_edited(long long num) {
//    if(num<SIZE) {
//        if(primes[num]=='0')return 1;
//        return 0;
//    }
//    for(LL t=2; t<=LL(sqrt(num)); t++) {
//        if(primes[t]=='1')continue;
//        if(num%t==0)return 0;
//    }
//    return 1;
//}

/////////////////////////////////////////////////////////
#define DEBUG 0

int a[1000000];
int b[1000000];

int main() {
    int m,n,k;
    cin>>m>>n>>k;
    int xx=0,yy=0;
    for(int t=0;t<m;t++){cin>>a[t];xx+=a[t];}
    for(int t=0;t<n;t++){cin>>b[t];yy+=b[t];}
    qsort(a,m,sizeof(int),compare);
    qsort(b,n,sizeof(int),compare);
    if(m>n)cout<<"YES"<<endl;
    else{
        int done = 0;
        for(int t=1;t<=m;t++){
            if(a[m-t]>b[n-t]){
                if(DEBUG)cout<<a[t]<<" "<<b[t]<<endl;
                cout<<"YES"<<endl;
                done=1;
                break;
            }
        }if(done==0)cout<<"NO"<<endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <set>
#include <climits>
#include <utility>

using namespace std;

#define PI 3.14159265358979323846264
#define SIZE 1000000000
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MOD 747474747
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MODE(a) ((a)<0?(-1*(a)):(a))
#define ROOT2 1.41421356237309504880

typedef unsigned long UL;
typedef long long LL;
typedef unsigned long long ULL;
typedef long L;

//char buffer[SIZE];

char * pt;
long get_int() {
    long temp=0;
    while(*pt<'0' && *pt>'9')pt++;
    while(*pt>='0' && *pt<='9') {
        temp=temp*10+(*pt-'0');
        pt++;
    }
    pt++;
    return temp;
}

long long gcd(LL a,LL b) {
    if(b==1 || a==1)return 1;
    if(a%b==0)return b;
    else return gcd(b,a%b);
}

LL fastPower(LL a,LL b) { //finds a to the power b
    if(b==0) return 1;
    if(b==1)return a%MOD;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=MOD;
    if(b%2)ans*=a;
    return ans%MOD;
}

LL fastPowerCustomMod(LL a,LL b,LL c) { //finds a to the power b mod c
    if(b==0) return 1;
    if(b==1)return a%c;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=c;
    if(b%2)ans*=a;
    return ans%c;
}

int is_prime(long long num) {
    if(num==2||num==3)return 1;
    if(num%2==0 || num%3==0)return 0;
    LL i=5,w=2;
    while(i*i < num) {
        if(num%i==0)return 0;
        i+=w;
        w=6-w;
    }
    return 1;
}

int compare (const void * a, const void * b) {
    return ( *(int*)a - *(int*)b );
}

int dec_compare (const void * a, const void * b) {
    return ( - *(int*)a + *(int*)b );
}

LL eularTotient(LL n) {
    LL result = n;
    for(LL i=2; i*i <= n; i++) {
        if (n % i == 0) result -= result / i;
        while (n % i == 0) n /= i;
    }
    if (n > 1) result -= result / n;
    return result;
}

////char primes[SIZE];
////int pr[SIZE],pc=0;
//
//int mark_primes() { //SIZE is size of array u want to mark primes in
//    memset(primes,'0',sizeof(primes));
//    primes[1]='1';
//    for(LL t=2; t<SIZE; t++) {
//        if(primes[t]=='0') {
////pr[pc++]=t;
//            for(LL tt=2*t; tt<=SIZE; tt+=t)
//                primes[tt]='1';
//        }
//    }
//    return 0;
//}// it marks 0 to prime numbers

//int is_prime_edited(long long num) {
//    if(num<SIZE) {
//        if(primes[num]=='0')return 1;
//        return 0;
//    }
//    for(LL t=2; t<=LL(sqrt(num)); t++) {
//        if(primes[t]=='1')continue;
//        if(num%t==0)return 0;
//    }
//    return 1;
//}

/////////////////////////////////////////////////////////
#define DEBUG 1

int a[1000000];
int b[1000000];

int main() {
    int m,n,k;
    cin>>m>>n>>k;
    for(int t=0;t<m;t++)cin>>a[t];
    for(int t=0;t<n;t++)cin>>b[t];
    qsort(a,m,sizeof(int),compare);
    qsort(b,n,sizeof(int),compare);
    int x=0,y=0;
    for(int t=m-1;t>=0;t--){
        if(a[t]==a[m-1])x++;
        else break;
    }
    for(int t=n-1;t>=0;t--){
        if(b[t]==b[n-1])y++;
        else break;
    }if(x>y)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <set>
#include <climits>
#include <utility>

using namespace std;

#define PI 3.14159265358979323846264
#define SIZE 1000000000
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MOD 747474747
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MODE(a) ((a)<0?(-1*(a)):(a))
#define ROOT2 1.41421356237309504880

typedef unsigned long UL;
typedef long long LL;
typedef unsigned long long ULL;
typedef long L;

//char buffer[SIZE];

char * pt;
long get_int() {
    long temp=0;
    while(*pt<'0' && *pt>'9')pt++;
    while(*pt>='0' && *pt<='9') {
        temp=temp*10+(*pt-'0');
        pt++;
    }
    pt++;
    return temp;
}

long long gcd(LL a,LL b) {
    if(b==1 || a==1)return 1;
    if(a%b==0)return b;
    else return gcd(b,a%b);
}

LL fastPower(LL a,LL b) { //finds a to the power b
    if(b==0) return 1;
    if(b==1)return a%MOD;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=MOD;
    if(b%2)ans*=a;
    return ans%MOD;
}

LL fastPowerCustomMod(LL a,LL b,LL c) { //finds a to the power b mod c
    if(b==0) return 1;
    if(b==1)return a%c;
    LL ans = fastPower(a,b/2);
    ans*=ans;
    ans%=c;
    if(b%2)ans*=a;
    return ans%c;
}

int is_prime(long long num) {
    if(num==2||num==3)return 1;
    if(num%2==0 || num%3==0)return 0;
    LL i=5,w=2;
    while(i*i < num) {
        if(num%i==0)return 0;
        i+=w;
        w=6-w;
    }
    return 1;
}

int compare (const void * a, const void * b) {
    return ( *(int*)a - *(int*)b );
}

int dec_compare (const void * a, const void * b) {
    return ( - *(int*)a + *(int*)b );
}

LL eularTotient(LL n) {
    LL result = n;
    for(LL i=2; i*i <= n; i++) {
        if (n % i == 0) result -= result / i;
        while (n % i == 0) n /= i;
    }
    if (n > 1) result -= result / n;
    return result;
}

////char primes[SIZE];
////int pr[SIZE],pc=0;
//
//int mark_primes() { //SIZE is size of array u want to mark primes in
//    memset(primes,'0',sizeof(primes));
//    primes[1]='1';
//    for(LL t=2; t<SIZE; t++) {
//        if(primes[t]=='0') {
////pr[pc++]=t;
//            for(LL tt=2*t; tt<=SIZE; tt+=t)
//                primes[tt]='1';
//        }
//    }
//    return 0;
//}// it marks 0 to prime numbers

//int is_prime_edited(long long num) {
//    if(num<SIZE) {
//        if(primes[num]=='0')return 1;
//        return 0;
//    }
//    for(LL t=2; t<=LL(sqrt(num)); t++) {
//        if(primes[t]=='1')continue;
//        if(num%t==0)return 0;
//    }
//    return 1;
//}

/////////////////////////////////////////////////////////
#define DEBUG 1

int a[1000000];
int b[1000000];

int main() {
    int m,n,k;
    cin>>m>>n>>k;
    int xx=0,yy=0;
    for(int t=0;t<m;t++){cin>>a[t];xx+=a[t];}
    for(int t=0;t<n;t++){cin>>b[t];yy+=b[t];}
    qsort(a,m,sizeof(int),compare);
    qsort(b,n,sizeof(int),compare);
    if(m>n)cout<<"YES"<<endl;
    else{
        int done = 0;
        for(int t=m-1;t>=0;t--){
            if(a[t]>b[t]){
                cout<<"YES"<<endl;
                done=1;
                break;
            }
        }if(done==0)cout<<"NO"<<endl;
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string.h>

using namespace std;

long b[1000000];
long a[1000000];
long n,m,k;

int main()
{
    long i;
    cin >> n >> m >> k ;
    for (i=1 ; i<=n ; i++) {
        cin >> a[i];
        }
    for (i=1 ; i<=m ; i++){
        cin >> b[i];
    }
    sort(a+1,a+n+1);
    sort(b+1,b+m+1);

    long j;
    i=m;
    j=n;
    while (true)  {
        if (a[j] <= b[i]) {
            i--;
            j--;
        } else{           cout << "YES";
        return 0;
    }
    if (i==0 || j==0 ) break;
  }
   if (j==0 && i != 0 ) {
     cout << "YES";
     return 0;
   }
   cout << "NO";
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string.h>

using namespace std;

long b[1000000];
long a[1000000];
long n,m,k;

int main()
{
    long i;
    cin >> n >> m >> k ;
    for (i=1 ; i<=n ; i++) {
        cin >> a[i];
        }
    for (i=1 ; i<=m ; i++){
        cin >> b[i];
    }
    sort(a+1,a+n+1);
    sort(b+1,b+m+1);

    long j;
    i=m;
    j=n;
    while (true)  {
        if (a[j] <= b[i]) {
            i--;
            j--;
        } else{           cout << "YES";
        return 0;
    }
    if (i==0 || j==0 ) break;
  }
   if (i==0 && j!=0) {
     cout << "YES";
     return 0;
   }
   cout << "NO";
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string.h>

using namespace std;

long b[1000000];
long a[1000000];
long n,m,k;

int main()
{
    long i;
    cin >> n >> m >> k ;
    for (i=1 ; i<=n ; i++) {
        cin >> a[i];
        }
    for (i=1 ; i<=m ; i++){
        cin >> b[i];
    }
    sort(a+1,a+n+1);
    sort(b+1,b+m+1);
    if (n>=m) {
         cout << "YES";
         return 0;
    }
    long j;
    i=m;
    j=n;
    while (true)  {
        if (a[j] <= b[i]) {
            i--;
            j--;
        } else cout << "YES";
    }
    cout << "NO";
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string.h>

using namespace std;

long b[1000000];
long a[1000000];
long n,m,k;

int main()
{
    long i;
    cin >> n >> m >> k ;
    for (i=1 ; i<=n ; i++) {
        cin >> a[i];
        }
    for (i=1 ; i<=m ; i++){
        cin >> b[i];
    }
    sort(a+1,a+n+1);
    sort(b+1,b+m+1);

    long j;
    i=m;
    j=n;
    while (true)  {
        if (a[j] <= b[i]) {
            i--;
            j--;
        } else{           cout << "YES";
        return 0;
    }
    if (i==0 || j==0 ) break;
  }

   cout << "NO";
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string.h>

using namespace std;

long b[1000000];
long a[1000000];
long n,m,k;

int main()
{
    long i;
    cin >> n >> m >> k ;
    for (i=1 ; i<=n ; i++) {
        cin >> a[i];
        }
    for (i=1 ; i<=m ; i++){
        cin >> b[i];
    }
    sort(a+1,a+n+1);
    sort(b+1,b+m+1);
    if (n>=m) {
         cout << "YES";
         return 0;
    }
    long j;
    i=m;
    j=n;
    while (true)  {
        if (a[j] <= b[i]) {
            i--;
            j--;
        } else{           cout << "YES";
        return 0;
    }
    if (i==0 || j==0 ) break;
  }

   cout << "NO";
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int n , m ,k;
int a[111111],b[111111];

bool check()
{
    for(int i = 0 ; i < n ; i++)
        if(a[i] > b[m-n+i])
            return true;

    return false;
}
int main()
{
    cin >> n >> m >> k;
    for(int i = 0 ; i < n ; i++) cin >> a[i];
    for(int i = 0 ; i < m ; i++) cin >> b[i];
    sort(a,a+n);
    sort(b,b+m);

    if(check())
        puts("YES");
    else
        puts("NO");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int n , m ,k;
int a[11111],b[11111];

bool check()
{
    for(int i = 0 ; i < n ; i++)
        if(a[i] > b[m-n+i])
            return true;

    return false;
}
int main()
{
    cin >> n >> m >> k;
    for(int i = 0 ; i < n ; i++) cin >> a[i];
    for(int i = 0 ; i < m ; i++) cin >> b[i];
    sort(a,a+n);
    sort(b,b+m);

    if(check())
        puts("YES");
    else
        puts("NO");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int n , m ,k;
int a[11111],b[11111];

bool check()
{
    for(int i = 0 ; i < n ; i++)
        if(a[i] > b[m-n+i])
            return true;

    return false;
}
int main()
{
    cin >> n >> m >> k;
    for(int i = 0 ; i < n ; i++) cin >> a[i];
    for(int i = 0 ; i < m ; i++) cin >> b[i];
    sort(a,a+n);
    sort(b,b+n);

    if(check())
        puts("YES");
    else
        puts("NO");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

long long n,m,k;
vector<int> A;
vector<int> B;
long long cmp[11111];

long long binfind(long long obj)
{
    int f,r,m;
    f = -1 ; r = B.size() - 1;
    while(f+1 != r)
    {
        m = f + (r-f)/2;
        if(B[m] < obj) { f = m;}
        else {r = m;}
    }
    return B.size() - r;
}

bool check()
{
    for(int i = 0 ; i < n ; i ++)
    {
        if(cmp[i] > 0)
            return true;
    }
    return false;
}

int main()
{
    while(cin >> n >> m >> k)
    {
        A.clear();
        B.clear();

        long long tmp;
        for(int i = 0 ; i < n ; i++)
        {
            cin >> tmp;
            A.push_back(tmp);
        }
        for(int i = 0 ; i < m ; i++)
        {
            cin >> tmp;
            B.push_back(tmp);
        }

        sort(A.begin(),A.end());
        sort(B.begin(),B.end());

        //for(int i = 0 ; i < n ; i++)
          //  cout << A[i] << " ";
        //cout << endl;
        //for(int i = 0 ; i < m ; i++)
          //  cout << A[i] << " ";
        //cout << endl;

        memset(cmp,0,sizeof(cmp));
        for(int i = 0 ; i < n ; i++)
        {
            int f,r;
            f = n - i;
            r = binfind(A[i]);
            cmp[i] = f-r;
            //         cout << f << " " << r << " " << cmp[i] << endl;
        }
        if(check())
            puts("YES");
        else
            puts("NO");

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

int n,m,k;
vector<int> A;
vector<int> B;
int cmp[11111];

int binfind(int obj)
{
    int f,r,m;
    f = 0 ; r = B.size() - 1;
    while(f+1 != r)
    {
        m = f + (r-f)/2;
        if(B[m] < obj) { f = m;}
        else {r = m;}
    }
    return B.size() - r;
}

bool check()
{
    for(int i = 0 ; i < n ; i ++)
    {
        if(cmp[i] > 0)
            return true;
    }
    return false;
}

int main()
{
    while(cin >> n >> m >> k)
    {
        A.clear();
        B.clear();

        int tmp;
        for(int i = 0 ; i < n ; i++)
        {
            cin >> tmp;
            A.push_back(tmp);
        }
        for(int i = 0 ; i < m ; i++)
        {
            cin >> tmp;
            B.push_back(tmp);
        }

        sort(A.begin(),A.end());
        sort(B.begin(),B.end());
        memset(cmp,0,sizeof(cmp));
        for(int i = 0 ; i < n ; i++)
        {
            int f,r;
            f = n - i;
            r = binfind(A[i]);
            cmp[i] = f-r;
        }
        if(check())
            puts("YES");
        else
            puts("NO");

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

int n,m,k;
vector<int> A;
vector<int> B;
int cmp[11111];

int binfind(int obj)
{
    int f,r,m;
    f = -1 ; r = B.size() - 1;
    while(f+1 != r)
    {
        m = f + (r-f)/2;
        if(B[m] < obj) { f = m;}
        else {r = m;}
    }
    return B.size() - r;
}

bool check()
{
    for(int i = 0 ; i < n ; i ++)
    {
        if(cmp[i] > 0)
            return true;
    }
    return false;
}

int main()
{
    while(cin >> n >> m >> k)
    {
        A.clear();
        B.clear();

        int tmp;
        for(int i = 0 ; i < n ; i++)
        {
            cin >> tmp;
            A.push_back(tmp);
        }
        for(int i = 0 ; i < m ; i++)
        {
            cin >> tmp;
            B.push_back(tmp);
        }

        sort(A.begin(),A.end());
        sort(B.begin(),B.end());

        //for(int i = 0 ; i < n ; i++)
          //  cout << A[i] << " ";
        //cout << endl;
        //for(int i = 0 ; i < m ; i++)
          //  cout << A[i] << " ";
        //cout << endl;

        memset(cmp,0,sizeof(cmp));
        for(int i = 0 ; i < n ; i++)
        {
            int f,r;
            f = n - i;
            r = binfind(A[i]);
            cmp[i] = f-r;
            //         cout << f << " " << r << " " << cmp[i] << endl;
        }
        if(check())
            puts("YES");
        else
            puts("NO");

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

int n,m,k;
vector<int> A;
vector<int> B;
int cmp[11111];

int binfind(int obj)
{
    int f,r,m;
    f = 0 ; r = B.size() - 1;
    while(f!=r)
    {
        m = (f+r)/2;
        if(B[m] < obj) { f = m+1 ;}
        else {r = m;}
    }
    return B.size() - f;
}

bool check()
{
    for(int i = 0 ; i < n ; i ++)
    {
        if(cmp[i] > 0)
            return true;
    }
    return false;
}

int main()
{
    while(cin >> n >> m >> k)
    {
        A.clear();
        B.clear();

        int tmp;
        for(int i = 0 ; i < n ; i++)
        {
            cin >> tmp;
            A.push_back(tmp);
        }
        for(int i = 0 ; i < m ; i++)
        {
            cin >> tmp;
            B.push_back(tmp);
        }

        sort(A.begin(),A.end());
        sort(B.begin(),B.end());
        memset(cmp,0,sizeof(cmp));
        for(int i = 0 ; i < n ; i++)
        {
            int f,r;
            f = n - i;
            r = binfind(A[i]);
            cmp[i] = f-r;
        }
        if(check())
            puts("YES");
        else
            puts("NO");

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int bob[1000010];
int alice[100010];

int main()
{
    int n;
    int m,k;
    cin>>n>>m>>k;
      multiset<int> aa,bb;
      for(int i=0;i<n;i++)
      {
      scanf("%d",&alice[i]);
      aa.insert(alice[i]);
      }
      for(int i=0;i<m;i++)
      {
      scanf("%d",&bob[i]);
      bb.insert(bob[i]);
      }

      multiset<int> :: iterator it;
      for(int i=0;i<n;i++)
      {
                it=bb.find(alice[i]);
                if(it!=bb.end())
                {
                          bb.erase(it);
                            aa.erase(aa.find(alice[i]));
                }
      }
      vector<int> a;
      vector<int> b;
      multiset<int> ::iterator tt;
      for(tt=bb.begin();tt!=bb.end();tt++)
      {
           b.push_back(*tt);
      }
      for(it=aa.begin();it!=aa.end();it++)
      {
           a.push_back(*it);
      }
    int l=a.size();
    int dd=b.size();
      sort(a.begin(),a.end());
      sort(b.begin(),b.end());
    //cout<<endl;
    if(l>dd)
    {
         cout<<"YES"<<endl;
         return 0;
    }
    int idx=dd-l;
    for(int i=idx;i<l;i++)
    {
          if(a[i]>b[i])
          {
              cout<<"YES"<<endl;
              return 0;
          }
    }
    cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int bob[1000010];
int alice[100010];

int main()
{
    int n;
    int m,k;
    cin>>n>>m>>k;
      multiset<int> aa,bb;
      for(int i=0;i<n;i++)
      {
      scanf("%d",&alice[i]);
      aa.insert(alice[i]);
      }
      for(int i=0;i<m;i++)
      {
      scanf("%d",&bob[i]);
      bb.insert(bob[i]);
      }

      multiset<int> :: iterator it;
      for(int i=0;i<n;i++)
      {
                it=bb.find(alice[i]);
                if(it!=bb.end())
                {
                          bb.erase(it);
                            aa.erase(aa.find(alice[i]));
                }
      }
      vector<int> a;
      vector<int> b;
      multiset<int> ::iterator tt;
      for(tt=bb.begin();tt!=bb.end();tt++)
      {
           b.push_back(*tt);
      }
      for(it=aa.begin();it!=aa.end();it++)
      {
           a.push_back(*it);
      }
    int l=a.size();
    int dd=b.size();
      sort(a.begin(),a.end());
      sort(b.begin(),b.end());
    //cout<<endl;
    if(l>dd)
    {
         cout<<"YES"<<endl;
         return 0;
    }
    int idx=dd-l;
    int xx=0;
    for(int i=idx;i<dd;i++)
    {
          if(a[xx]>b[i])
          {
              cout<<"YES"<<endl;
              return 0;
          }
          xx++;
    }
    cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  int bob[1000010];
long long int alice[100010];

int main()
{
    int n;
    int m,k;
    cin>>n>>m>>k;
      multiset<long long int> aa,bb;
      for(int i=0;i<n;i++)
      {
      scanf("%lld",&alice[i]);
      aa.insert(alice[i]);
      }
      for(int i=0;i<m;i++)
      {
      scanf("%lld",&bob[i]);
      bb.insert(bob[i]);
      }

      multiset<long long int> :: iterator it;
      for(int i=0;i<n;i++)
      {
                it=bb.find(alice[i]);
                if(it!=bb.end())
                {
                          bb.erase(it);
                            aa.erase(aa.find(alice[i]));
                }
      }
      vector<long long int> a;
      vector<long long int> b;
      multiset<long long int> ::iterator tt;
      for(tt=bb.begin();tt!=bb.end();tt++)
      {
           b.push_back(*tt);
      }
      for(it=aa.begin();it!=aa.end();it++)
      {
           a.push_back(*it);
      }
    int l=a.size();
    int dd=b.size();

    //cout<<endl;
    if(l>dd)
    {
         cout<<"YES"<<endl;
         return 0;
    }
    int idx=dd-l;
    for(int i=idx;i<l;i++)
    {
          if(a[i]>b[i])
          {
              cout<<"YES"<<endl;
              return 0;
          }
    }
    cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int bob[1000010];
int alice[100010];

int main()
{
    int n;
    int m,k;
    cin>>n>>m>>k;
      multiset<int> aa,bb;
      for(int i=0;i<n;i++)
      {
      cin>>alice[i];
      aa.insert(alice[i]);
      }
      for(int i=0;i<m;i++)
      {
      cin>>bob[i];
      bb.insert(bob[i]);
      }

      multiset<int> :: iterator it;
      for(int i=0;i<n;i++)
      {
                it=bb.find(alice[i]);
                if(it!=bb.end())
                {
                          bb.erase(it);
                            aa.erase(aa.find(alice[i]));
                }
      }
      vector<int> a;
      vector<int> b;
      multiset<int> ::iterator tt;
      for(tt=bb.begin();tt!=bb.end();tt++)
      {
           b.push_back(*tt);
      }
      for(it=aa.begin();it!=aa.end();it++)
      {
           a.push_back(*it);
      }
    int l=a.size();
    int dd=b.size();

    //cout<<endl;
    if(l>dd)
    {
         cout<<"YES"<<endl;
         return 0;
    }
    int idx=dd-l;
    for(int i=idx;i<l;i++)
    {
          if(a[i]>b[i])
          {
              cout<<"YES"<<endl;
              return 0;
          }
    }
    cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  int bob[1000010];
long long int alice[1000010];

int main()
{
    int n;
    int m,k;
    cin>>n>>m>>k;
      //multiset<long long int> aa,bb;
      vector<long long int> a,b;
      for(int i=0;i<n;i++)
      {
        scanf("%lld",&alice[i]);
        //aa.insert(alice[i]);
      }
      for(int i=0;i<m;i++)
      {
        scanf("%lld",&bob[i]);
       // bb.insert(bob[i]);
      }
    int l=a.size();
    int dd=b.size();
    if(l>dd)
    {
         cout<<"YES"<<endl;
         return 0;
    }
    int idx=dd-l;
//  cout<<idx<<endl;
    for(int i=idx;i<l;i++)
    {
          if(a[i]>b[i])
          {
              cout<<"YES"<<endl;
              return 0;
          }
    }
    cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  int bob[1000010];
long long int alice[1000010];

int main()
{
    int n;
    int m,k;
    cin>>n>>m>>k;
      //multiset<long long int> aa,bb;
      vector<long long int> a,b;
      for(int i=0;i<n;i++)
      {
        scanf("%lld",&alice[i]);
        a.push_back(alice[i]);
      }
      for(int i=0;i<m;i++)
      {
        scanf("%lld",&bob[i]);
       b.push_back(bob[i]);
      }
    int l=a.size();
    int dd=b.size();
    if(l>dd)
    {
         cout<<"YES"<<endl;
         return 0;
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    int idx=dd-l;
    //cout<<idx<<endl;
    int xx=0;
    for(int i=idx;i<l;i++)
    {
         // cout<<a[xx]<<" "<<b[i]<<endl;
          if(a[xx]>b[i])
          {
              cout<<"YES"<<endl;
              return 0;
          }
          xx++;
    }
    cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int bob[1000010];
int alice[100010];
int main()
{
    int n;
    int m,k;
    cin>>n>>m>>k;
      for(int i=0;i<n;i++)
      {
      cin>>alice[i];
      alice[i]++;
      }
      for(int i=0;i<m;i++)
      {
      cin>>bob[i];bob[i]++;
      }
      vector<int> a;
      vector<int> b;
      for(int i=1;i<=100001;i++)
      {
            int temp=min(alice[i],bob[i]);
            alice[i]-=temp;
            bob[i]-=temp;
      }
       for(int i=1;i<=100001;i++)
       {
             for(int j=0;j<alice[i];j++)
             a.push_back(i);
             for(int j=0;j<bob[i];j++)
             b.push_back(i);
       }
       sort(b.begin(),b.end());
       sort(a.begin(),a.end());
    int l=a.size();
    vector<int>::iterator it;
    int mp=0;
     for(int i=0;i<l;i++)
     {
               it=lower_bound(b.begin(),b.end(),a[i]);
               if(it==b.end())
               {
                     cout<<"YES"<<endl;
                     return 0;
               }
               int pos=it-b.begin();
                int mp=max(pos,mp);

     }
     int rem=b.size()-mp+1;
     if(2*l>=rem)
     cout<<"YES"<<endl;
     else
     cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int bob[1000010];
int alice[100010];

int main()
{
    int n;
    int m,k;
    cin>>n>>m>>k;
      multiset<int> aa,bb;
      for(int i=0;i<n;i++)
      {
      scanf("%d",&alice[i]);
      aa.insert(alice[i]);
      }
      for(int i=0;i<m;i++)
      {
      scanf("%d",&bob[i]);
      bb.insert(bob[i]);
      }

      multiset<int> :: iterator it;
      for(int i=0;i<n;i++)
      {
                it=bb.find(alice[i]);
                if(it!=bb.end())
                {
                          bb.erase(it);
                            aa.erase(aa.find(alice[i]));
                }
      }
      vector<int> a;
      vector<int> b;
      multiset<int> ::iterator tt;
      for(tt=bb.begin();tt!=bb.end();tt++)
      {
           b.push_back(*tt);
      }
      for(it=aa.begin();it!=aa.end();it++)
      {
           a.push_back(*it);
      }
    int l=a.size();
    int dd=b.size();
      sort(a.begin(),a.end());
      sort(b.begin(),b.end());
    //cout<<endl;
    if(l>dd)
    {
         cout<<"YES"<<endl;
         return 0;
    }
    int idx=dd-l;
    int xx=0;
    for(int i=idx;i<l;i++)
    {
          if(a[xx]>b[i])
          {
              cout<<"YES"<<endl;
              return 0;
          }
          xx++;
    }
    cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int bob[1000010];
int alice[100010];

int main()
{
    int n;
    int m,k;
    cin>>n>>m>>k;
      multiset<int> aa,bb;
      for(int i=0;i<n;i++)
      {
      scanf("%d",&alice[i]);
      aa.insert(alice[i]);
      }
      for(int i=0;i<m;i++)
      {
      scanf("%d",&bob[i]);
      bb.insert(bob[i]);
      }

      multiset<int> :: iterator it;
      for(int i=0;i<n;i++)
      {
                it=bb.find(alice[i]);
                if(it!=bb.end())
                {
                          bb.erase(it);
                            aa.erase(aa.find(alice[i]));
                }
      }
      vector<int> a;
      vector<int> b;
      multiset<int> ::iterator tt;
      for(tt=bb.begin();tt!=bb.end();tt++)
      {
           b.push_back(*tt);
      }
      for(it=aa.begin();it!=aa.end();it++)
      {
           a.push_back(*it);
      }
    int l=a.size();
    int dd=b.size();

    //cout<<endl;
    if(l>dd)
    {
         cout<<"YES"<<endl;
         return 0;
    }
    int idx=dd-l;
    for(int i=idx;i<l;i++)
    {
          if(a[i]>b[i])
          {
              cout<<"YES"<<endl;
              return 0;
          }
    }
    cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int bob[1000010];
int alice[100010];

int main()
{
    int n;
    int m,k;
    cin>>n>>m>>k;
      multiset<int> aa,bb;
      for(int i=0;i<n;i++)
      {
      cin>>alice[i];
      aa.insert(alice[i]);
      }
      for(int i=0;i<m;i++)
      {
      cin>>bob[i];
      bb.insert(bob[i]);
      }

      multiset<int> :: iterator it;
      for(int i=0;i<n;i++)
      {
                it=bb.find(alice[i]);
                if(it!=bb.end())
                {
                          bb.erase(it);
                            aa.erase(aa.find(alice[i]));
                }
      }
      vector<int> a;
      vector<int> b;
      multiset<int> ::iterator tt;
      for(tt=bb.begin();tt!=bb.end();tt++)
      {
           b.push_back(*tt);
      }
      for(it=aa.begin();it!=aa.end();it++)
      {
           a.push_back(*it);
      }
    int l=a.size();
    int dd=b.size();
    cout<<l<<" "<<dd<<endl;
    for(int i=0;i<l;i++)
    cout<<a[i]<<" ";
    cout<<endl;
    for(int i=0;i<b.size();i++)
    cout<<b[i]<<" ";
    cout<<endl;
    if(l>dd)
    {
         cout<<"YES"<<endl;
         return 0;
    }
    int idx=dd-l;
    for(int i=idx;i<l;i++)
    {
          if(a[i]>b[i])
          {
              cout<<"YES"<<endl;
              return 0;
          }
    }
    cout<<"NO"<<endl;
    return 0;
}


//Fish Weight
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n,m,k,a[100001],b[100001];
int main()
{
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)
      cin>>a[i];
    for(int i=0;i<m;i++)
      cin>>b[i];
    if(n>m)cout<<"YES";
    else
    {
       bool ok=false;
       sort(a,a+n);
       sort(b,b+m);
       for(int i=n-1;i>=0;i--)
         if(a[i]>b[m-n+i])
         {
            ok=true;
            break;
         }
       if(ok)cout<<"YES";
       else cout<<"NO";
    }
    return 0;
}


//Fish Weight
//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,m,k,a[100001],b[100001];
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>b[i];
    sort(a,a+n);
    sort(b,b+m);
    for(int i=n-1;i>=0;i--)
      for(int j=i;j==i;j++)
        if(a[i]>b[j]){cout<<"YES";return 0;}
    cout<<"NO";
    return 0;
}


//Fish Weight
//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,m,k,a[100001],b[100001];
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>b[i];
    sort(a,a+n);
    sort(b,b+m);
    for(int i=n-1;i>=0;i--)
      for(int j=m-1;j==i;j--)
        if(a[i]>b[j]){cout<<"YES";return 0;}
    cout<<"NO";
    return 0;
}


//Fish Weight
//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,m,k,a[100001],b[100001],x=0,y=0,sum1=0,sum2=0;
    cin>>n>>m>>k;
    for(int i=0;i<n;i++){cin>>a[i];x=max(x,a[i]);sum1+=a[i];}
    for(int i=0;i<m;i++){cin>>b[i];y=max(y,b[i]);sum2+=b[i];}
    if(x>y||sum1>sum2)cout<<"YES";
    else cout<<"NO";
    return 0;
}


//Fish Weight
//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,m,k,a[100001],b[100001];
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>b[i];
    sort(a,a+n);
    sort(b,b+m);
    for(int i=n-1;i>=0;i--)
      for(int j=m-1;j-i==m-n;j--)
        if(a[i]>b[j]){cout<<"YES";return 0;}
    cout<<"NO";
    return 0;
}


//Fish Weight
//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,m,k,a[100001],b[100001];
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>b[i];
    sort(a,a+n);
    sort(b,b+m);
    for(int i=n-1;i>=0;i--)
      if(a[i]>b[m-n+i]&&m-n+i>=0)
      {cout<<"YES";
      return 0;
      }
    if(n>m)cout<<"YES";
    else cout<<"NO";
    return 0;
}


//Fish Weight
//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,m,k,a[100001],b[100001];
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>b[i];
    sort(a,a+n);
    sort(b,b+m);
    for(int i=n;i>=0;i--)
      for(int j=i;j==i;j++)
        if(a[i]>b[j]){cout<<"YES";return 0;}
    cout<<"NO";
    return 0;
}


//Fish Weight
//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,m,k,a[100001],b[100001];
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>b[i];
    sort(a,a+n);
    sort(b,b+m);
    for(int i=n-1;i>=0;i--)
      if(a[i]>b[m-n+i]&&m-n+i>=0)
      {cout<<"YES";
      return 0;
      }
    cout<<"NO";
    return 0;
}


#include <vector>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string.h>
#include <ctime>

using namespace std;

#define REP(i,n) for(int i=0; i<n; i++)
#define FOR(i,x,y) for(int i=x; i<=y; i++)

typedef long long ll;
main()
{
 //freopen("input.txt","r",stdin);
 //	freopen("output.txt","w",stdout);
 	int n,m,k,val;
 	cin>>n>>m>>k;
 	map <int,int> freq;
 	REP(i,n)
 	{
 		cin>>val;
 		freq[val]++;
	}
	REP(i,m)
	{
		cin>>val;
		freq[val]--;
	}
	ll ret=0;
	for(map <int,int> :: iterator it=freq.end();it!=freq.begin();it--)
	{
		ret+=it->second;
		if(ret>0)
		{
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
}


#include <vector>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string.h>
#include <ctime>

using namespace std;

#define REP(i,n) for(int i=0; i<n; i++)
#define FOR(i,x,y) for(int i=x; i<=y; i++)

typedef long long ll;
main()
{
 //freopen("input.txt","r",stdin);
 //	freopen("output.txt","w",stdout);
 std::ios::sync_with_stdio(false);
 	ll n,m,k,val;
 	cin>>n>>m>>k;
 	map <ll,ll> freq;
 	REP(i,n)
 	{
 		cin>>val;
 		freq[val]++;
	}
	REP(i,m)
	{
		cin>>val;
		freq[val]--;
	}
	ll ret=0;
	vector <ll> res;
	for(map <ll,ll> :: iterator it=freq.begin();it!=freq.end();it++)
		res.push_back(it->second);
	for(int i=res.size()-1;i>=0;i--)
	{
		ret+=res[i];
		if(ret>0)
		{
			cout<<"YES\n";
			return 0;
		}
	}
	cout<<"NO\n";
}


#include <vector>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string.h>
#include <ctime>

using namespace std;

#define REP(i,n) for(int i=0; i<n; i++)
#define FOR(i,x,y) for(int i=x; i<=y; i++)

typedef long long ll;
main()
{
 //freopen("input.txt","r",stdin);
 //	freopen("output.txt","w",stdout);
 	int n,m,k,val;
 	cin>>n>>m>>k;
 	map <int,int> freq;
 	REP(i,n)
 	{
 		cin>>val;
 		freq[val]++;
	}
	REP(i,m)
	{
		cin>>val;
		freq[val]--;
	}
	ll ret=0;
	map <int,int> :: iterator it=freq.end();
	for(it--;it!=freq.begin();it--)
	{
		ret+=it->second;
		if(ret>0)
		{
			printf("YES");
			return 0;
		}
	}
	printf("NO");
}