#include<iostream>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<vector>
#include<stack>
#include<deque>
#include<set>
#include<map>
using namespace std;
#define PB push_back
#define MP make_pair
#define L first
#define R second
typedef pair<int,int> pie;
multiset<int> s;
multiset<int> p;
vector<int> v;
vector<int> q;
int main()
{
	ios_base::sync_with_stdio(false);
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		int l;
		cin>>l;
		s.insert(l);
	}
	for(int i=1;i<=m;i++)
	{
		int l;
		cin>>l;
		if(s.count(l)==0)
			p.insert(l);
		else
			s.erase(s.find(l));
	}
	for(multiset<int>::iterator it = s.begin();it!=s.end();++it)
		v.PB(*it);
	for(multiset<int>::iterator it = p.begin();it!=p.end();++it)
		q.PB(*it);
	if(v.size()==0)
	{
		cout<<"NO";
		return 0;
	}
	if(q.size()==0)
	{
		cout<<"YES";
		return 0;
	}
	int maxx = v[v.size()-1];
	int moxx = q[q.size()-1];
	if(maxx>moxx)
	{
		cout<<"YES";
		return 0;
	}
	int ans = 0;
	int ons = 0;
	for(int i=0;i<q.size();i++)
		if(q[i]>maxx)
			ans++;
	if(v.size()>q.size())
	{
		cout<<"YES";
		return 0;
	}
	for(int i=0;i<v.size();i++)
		if(v[i]>q[i])
			ons ++;
	if(ons>ans)
	{
		cout<<"YES";
		return 0;
	}
	else
	{
		cout<<"NO";
		return 0;
	}
}


#include<iostream>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<vector>
#include<stack>
#include<deque>
#include<set>
#include<map>
using namespace std;
#define PB push_back
#define MP make_pair
#define L first
#define R second
typedef pair<int,int> pie;
map<int,int> m;
vector<int> v;
vector<int> q;
int main()
{
	ios_base::sync_with_stdio(false);
	int n,mm,k;
	cin>>n>>mm>>k;
	for(int i=1;i<=n;i++)
	{
		int l;
		cin>>l;
		m[l]++;
	}
	for(int i=1;i<=mm;i++)
	{
		int l;
		cin>>l;
		if(m[l]!=0)
			m[l]--;
		else
			q.PB(l);
	}
	for(map<int,int>::iterator it=m.begin();it!=m.end();++it)
	{
		int kk = it->L;
		int o = it->R;
		for(int i=0;i<o;i++)
			v.PB(kk);
	}
	sort(v.begin(),v.end());
	sort(q.begin(),q.end());
	if(v.size()==0)
	{
		cout<<"NO";
		return 0;
	}
	if(q.size()==0)
	{
		cout<<"YES";
		return 0;
	}
	int maxx = v[v.size()-1];
	int moxx = q[q.size()-1];
	if(maxx>moxx)
	{
		cout<<"YES";
		return 0;
	}
	int ans = 0;
	int ons = 0;
	if(v.size()>q.size())
	{
		cout<<"YES";
		return 0;
	}
	ans = q.size()-v.size();
	for(int i=0;i<v.size();i++)
		if(v[i]>q[i])
			ons++;
	if(ons>ans)
	{
		cout<<"YES";
		return 0;
	}
	else
	{
		cout<<"NO";
		return 0;
	}
}


#include<iostream>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<vector>
#include<stack>
#include<deque>
#include<set>
#include<map>
using namespace std;
#define PB push_back
#define MP make_pair
#define L first
#define R second
typedef pair<int,int> pie;
multiset<int> s;
multiset<int> p;
vector<int> v;
vector<int> q;
int main()
{
	ios_base::sync_with_stdio(false);
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		int l;
		cin>>l;
		s.insert(l);
	}
	for(int i=1;i<=m;i++)
	{
		int l;
		cin>>l;
		if(s.count(l)==0)
			p.insert(l);
		else
			s.erase(s.find(l));
	}
	for(multiset<int>::iterator it = s.begin();it!=s.end();++it)
		v.PB(*it);
	for(multiset<int>::iterator it = p.begin();it!=p.end();++it)
		q.PB(*it);
	if(v.size()==0)
	{
		cout<<"NO";
		return 0;
	}
	if(q.size()==0)
	{
		cout<<"YES";
		return 0;
	}
	int maxx = v[v.size()-1];
	int moxx = q[q.size()-1];
	if(maxx>moxx)
	{
		cout<<"YES";
		return 0;
	}
	int ans = 0;
	int ons = 0;
	if(v.size()>q.size())
	{
		cout<<"YES";
		return 0;
	}
	ans = q.size()-v.size();
	for(int i=0;i<v.size();i++)
		if(v[i]>q[i])
			ons++;
	if(ons>ans)
	{
		cout<<"YES";
		return 0;
	}
	else
	{
		cout<<"NO";
		return 0;
	}
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main () {
		int n,m,k,sum = 0,sum1 = 0;;
		cin >> n >> m >> k;
		vector <int> vn (n);
		vector <bool> vk (k+1);
		vector <int> vm (m,false);
		for (int i = 0; i < n; i++) {
			int a;
			cin >> vn[i];
			sum = sum + 2;
			vk[vn[i]] = true;
		}
		for (int i = 0; i < m; i++) {
			cin >> vm[i];
			if (vk[vm[i]] == true) {
				sum1 = sum1 + 2;
			}
			else {
				sum1 = sum1 + 1;
			}
		}
		if (sum > sum1)
			cout << "YES" <<endl;
		else
			cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool comp (int a, int b) {
	return a > b;
}
int main () {
		int n,m,k,sum = 0,sum1 = 0;;
		cin >> n >> m >> k;
		vector <int> vn (n);
		vector <bool> vk (k+1,false);
		vector <int> vm (m);
		if (n > m) {
			cout <<"YES"<<endl;
			return 0;
		}
		for (int i = 0; i < n; i++) {
			cin >> vn[i];
		}
		for (int i = 0; i < m; i++) {
			cin >> vm[i];
		}
		sort(vn.begin(),vn.end(),comp);
		sort (vm.begin(),vm.end(),comp);
		for (int i = 0; i < n; i++) {
			cout << vn[i] << endl;
		}
		for (int i = 0; i < n; i++) {
			if (vn[i] > vm[i]) {
				cout << "YES" <<endl;
				return 0;
			}
		}
		cout <<"NO"<<endl;
		return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main () {
		int n,m,k,sum = 0,sum1 = 0;;
		cin >> n >> m >> k;
		vector <int> vn (n);
		vector <bool> vk (k+1,false);
		vector <int> vm (m);
		if (n > m) {
			cout <<"YES"<<endl;
			return 0;
		}
		for (int i = 0; i < n; i++) {
			cin >> vn[i];
		}
		for (int i = 0; i < m; i++) {
			cin >> vm[i];
		}
		sort(vn.begin(),vn.end());
		sort (vm.begin(),vm.end());
		for (int i = 0; i < n; i++) {
			if (vn[i] > vm[i]) {
				cout << "YES" <<endl;
				return 0;
			}
		}
		cout <<"NO"<<endl;
		return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool comp (int a, int b) {
	return a > b;
}
int main () {
		int n,m,k,sum = 0,sum1 = 0;;
		cin >> n >> m >> k;
		vector <int> vn (n);
		vector <bool> vk (k+1,false);
		vector <int> vm (m);
		if (n > m) {
			cout <<"YES"<<endl;
			return 0;
		}
		for (int i = 0; i < n; i++) {
			cin >> vn[i];
		}
		for (int i = 0; i < m; i++) {
			cin >> vm[i];
		}
		sort(vn.begin(),vn.end(),comp);
		sort (vm.begin(),vm.end(),comp);
		//for (int i = 0; i < n; i++) {
		//	cout << vn[i] << endl;
		//}
		for (int i = 0; i < n; i++) {
			if (vn[i] > vm[i]) {
				cout << "YES" <<endl;
				return 0;
			}
		}
		cout <<"NO"<<endl;
		return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool comp (int a, int b) {
	return a > b;
}
int main () {
		int n,m,k,sum = 0,sum1 = 0;;
		cin >> n >> m >> k;
		vector <int> vn (n);
		vector <bool> vk (k+1,false);
		vector <int> vm (m);
		if (n > m) {
			cout <<"YES"<<endl;
			return 0;
		}
		for (int i = 0; i < n; i++) {
			cin >> vn[i];
		}
		for (int i = 0; i < m; i++) {
			cin >> vm[i];
		}
		sort(vn.begin(),vn.end(),comp);
		sort (vm.begin(),vm.end(),comp);
		for (int i = 0; i > n; i++) {
			if (vn[i] > vm[i]) {
				cout << "YES" <<endl;
				return 0;
			}
		}
		cout <<"NO"<<endl;
		return 0;
}


#include <iostream>
#include <string.h>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <limits.h>
#include <vector>
#include <string>
#include <ctype.h>
#include <complex>
#include <cmath>
using namespace             std;
const int                   Maxn=320000,Maxm=2500000,Mo=1000000007,oo=INT_MAX>>2;
int                         n,m,ans,i,j,a[Maxn],ar[Maxn],rd[Maxn],rd0,ar0;
double                      sumxf,xf[Maxn];
map<int, int> mp;
int main()
{
    ios::sync_with_stdio(0);
//    freopen("/Users/MAC/Desktop/Error202/Error202/1.in","r",stdin);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.out","w",stdout);
    int k;
    cin>>n>>m>>k;
    for (i=1;i<=n;i++) {
        cin>>a[i];
        mp[a[i]]++;
    }
    for (i=1;i<=m;i++){
        int b;
        cin>>b;
        if (mp[b]>0) mp[b]--;
    }
    int ck=0;
    for (i=1;i<=n;i++){
        if (mp[a[i]]>0) ck=1;
    }
    if (ck) cout<<"YES\n"; else  cout<<"NO\n";
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 100002;
int a[maxn],b[maxn];
int m,n,k;

void read() {
    for (int i=0;i<n;i++) {
        scanf("%d",&a[i]);
    }
    for (int i=0;i<m;i++) {
        scanf("%d",&b[i]);
    }
    sort(a, a+n);
    sort(b, b+m);
    return;
}

void solve() {
    int l = n-1, r = m-1;
    bool flag = false;
    while (l >= 0 && r >= 0) {
        if (b[r] < a[l]) {
            flag = true;
            break;
        }
        l--;
        r--;
    }
    puts(flag ? "YES" : "NO");
    return;
}

int main() {
    while(~scanf("%d%d%d",&n,&m,&k)) {
        read();
        solve();
    }
    return 0;
}


#include <iostream>
#include <string.h>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <limits.h>
#include <vector>
#include <string>
#include <ctype.h>
#include <complex>
#include <cmath>
using namespace             std;
const int                   Maxn=300,Maxm=2500000,Mo=1000000007,oo=INT_MAX>>2;
int                         n,m,ans,i,j,a[Maxn],ar[Maxn],rd[Maxn],rd0,ar0;
double                      sumxf,xf[Maxn];
map<int, int> mp;
int main()
{
    ios::sync_with_stdio(0);
    int k;
    cin>>n>>m>>k;
    for (i=1;i<=n;i++) {
        cin>>a[i];
        mp[a[i]]++;
    }
    for (i=1;i<=m;i++){
        int b;
        cin>>b;
        mp[b]--;
        a[n+i]=b;
    }
    int ck=0,sum=0;
    sort(a+1,a+n+m+1);
    int len=(unique(a+1, a+n+m+1)-a)-1;
    for (i=len;i>=1;i--){
        sum+=mp[a[i]];
        if (sum>0) ck=1;
    }
    if (ck) cout<<"YES\n"; else  cout<<"NO\n";
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 100002;
int a[maxn],b[maxn];
int m,n,k;

void read() {
    for (int i=0;i<n;i++) {
        scanf("%d",&a[i]);
    }
    for (int i=0;i<m;i++) {
        scanf("%d",&b[i]);
    }
    sort(a, a+n);
    sort(b, b+m);
    return;
}

void solve() {
    int l = n-1, r = m-1;
    bool flag = false;
    while (l >= 0 && r >= 0) {
        if (a[l] == b[r]) continue;
        if (b[r] < a[l]) {
            flag = true;
            break;
        }
        l--;
        r--;
    }
    puts(flag ? "YES" : "NO");
    return;
}

int main() {
    while(~scanf("%d%d%d",&n,&m,&k)) {
        read();
        solve();
    }
    return 0;
}


#include <iostream>
#include <string.h>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <limits.h>
#include <vector>
#include <string>
#include <ctype.h>
#include <complex>
#include <cmath>
using namespace             std;
const int                   Maxn=300000,Maxm=2500000,Mo=1000000007,oo=INT_MAX>>2;
int                         n,m,ans,i,j,a[Maxn],ar[Maxn],rd[Maxn],rd0,ar0;
double                      sumxf,xf[Maxn];
map<int, int> mp;
int main()
{
    ios::sync_with_stdio(0);
   //   freopen("/Users/MAC/Desktop/Error202/Error202/1.in","r",stdin);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.out","w",stdout);
    int k;
    cin>>n>>m>>k;
    for (i=1;i<=n;i++) {
        cin>>a[i];
        mp[a[i]]++;
    }
    for (i=1;i<=m;i++){
        int b;
        cin>>b;
        mp[b]--;
        a[n+i]=b;
    }
    int ck=0,sum=0;
    sort(a+1,a+n+m+1);
    int len=(unique(a+1, a+n+m+1)-a)-1;
    for (i=len;i>=1;i--){
        sum+=mp[a[i]];
        if (sum>0) ck=1;
    }
    if (ck) cout<<"YES\n"; else  cout<<"NO\n";
}


#include <iostream>
#include <string.h>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <limits.h>
#include <vector>
#include <string>
#include <ctype.h>
#include <complex>
#include <cmath>
using namespace             std;
const int                   Maxn=300000,Maxm=2500000,Mo=1000000007,oo=INT_MAX>>2;
int                         n,m,ans,i,j,a[Maxn],ar[Maxn],rd[Maxn],rd0,ar0;
double                      sumxf,xf[Maxn];
map<int, int> mp;
int main()
{
    ios::sync_with_stdio(0);
   // freopen("/Users/MAC/Desktop/Error202/Error202/1.in","r",stdin);
    //freopen("/Users/MAC/Desktop/Error202/Error202/1.out","w",stdout);
    int k;
    cin>>n>>m>>k;
    for (i=1;i<=n;i++) {
        cin>>a[i];
        mp[a[i]]++;
    }
    for (i=1;i<=m;i++){
        int b;
        cin>>b;
        mp[b]--;
        a[n+i]=b;
    }
    int ck=0,sum=0;
    sort(a+1,a+n+m+1);
    int len=(unique(a+1, a+n+m+1)-a)-1;
    for (i=len;i>=1;i--){
        sum+=mp[a[i]];
        if (sum>0) ck=1;
    }
    if (ck) cout<<"YES\n"; else  cout<<"NO\n";
}


/*
 * Bidhan Roy
 * University of Dhaka
 */

using namespace std;

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <ctime>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)
#define inf (1<<30)
#define eps 1e-9
#define pb push_back
#define ins insert
#define mp make_pair
#define sz(x) ((int)x.size())
#define clr clear()
#define all(x) x.begin(),x.end()
#define xx first
#define yy second
#define sqr(x) ((x)*(x))
#define mem(x,val) memset((x),(val),sizeof(x));
#define read(x) freopen(x,"r",stdin);
#define rite(x) freopen(x,"w",stdout);

template <class T> inline T __in() { T v; cin>>v; return v; }

#define Q __in<int>()
#define QQ __in<i64>()
#define QS __in<st>()

typedef long long i64;
typedef unsigned long long ui64;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
typedef map<int,int> mii;
typedef map<st,int> msi;
typedef map<int,st> mis;
typedef set<int> si;
typedef set<st> ss;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define mx 0

int main(){
	ios_base::sync_with_stdio(0);
	int n=Q, m=Q, k=Q;
	mii aa, bb;
	rep(i,n) aa[Q]++;
	rep(j,m) bb[Q]++;
	foreach(it,aa){
	    int am=it->yy;
	    am=min(am,bb[it->xx]);
	    aa[it->xx]-=am;
	    bb[it->xx]-=am;
	}
	vpii A,B;
	foreach(it,aa){
	    if(!it->yy) continue;
	    A.pb(*it);
	}
	foreach(it,bb){
	    if(!it->yy) continue;
	    //cout<<it->xx<<" "<<it->yy<<endl;
	    B.pb(*it);
	}
	//cout<<sz(A)<<" "<<sz(B)<<endl;
	sort(all(A));
	sort(all(B));
	int i=0,j=0;
	int sm=0;
	while(i<sz(A) && j<sz(B)){
	    if(A[i].xx>B[j].xx) j++;
	    else if(A[i].xx<B[j].xx && A[i].yy>=B[j].yy){
	        A[i].yy-=B[j].yy;
	        if(!A[i].yy) i++;
	        j++;
	    }
	    else {
	        B[j].yy-=A[i].yy;
	        if(!B[j].yy) j++;
	        i++;
	    }
	}
	if(j==sz(B)) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


/*
 * Bidhan Roy
 * University of Dhaka
 */

using namespace std;

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <ctime>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)
#define inf (1<<30)
#define eps 1e-9
#define pb push_back
#define ins insert
#define mp make_pair
#define sz(x) ((int)x.size())
#define clr clear()
#define all(x) x.begin(),x.end()
#define xx first
#define yy second
#define sqr(x) ((x)*(x))
#define mem(x,val) memset((x),(val),sizeof(x));
#define read(x) freopen(x,"r",stdin);
#define rite(x) freopen(x,"w",stdout);

template <class T> inline T __in() { T v; cin>>v; return v; }

#define Q __in<int>()
#define QQ __in<i64>()
#define QS __in<st>()

typedef long long i64;
typedef unsigned long long ui64;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
typedef map<int,int> mii;
typedef map<st,int> msi;
typedef map<int,st> mis;
typedef set<int> si;
typedef set<st> ss;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define mx 0

int main(){
	ios_base::sync_with_stdio(0);
	int n=Q, m=Q, k=Q;
	mii aa, bb;
	rep(i,n) aa[Q]++;
	rep(j,m) bb[Q]++;
	foreach(it,aa){
	    int am=it->yy;
	    am=min(am,bb[it->xx]);
	    aa[it->xx]-=am;
	    bb[it->xx]-=am;
	}
	vpii A,B;
	foreach(it,aa){
	    if(!it->yy) continue;
	    A.pb(*it);
	}
	foreach(it,bb){
	    if(!it->yy) continue;
	    //cout<<it->xx<<" "<<it->yy<<endl;
	    B.pb(*it);
	}
	//cout<<sz(A)<<" "<<sz(B)<<endl;
	sort(all(A));
	sort(all(B));
	if(A==B){
	    cout<<"NO"<<endl;
	    return 0;
	}
	int i=0,j=0;
	int sm=0;
	while(i<sz(A) && j<sz(B)){
	    if(A[i].xx>B[j].xx) j++;
	    else if(A[i].xx<B[j].xx && A[i].yy>=B[j].yy){
	        A[i].yy-=B[j].yy;
	        if(!A[i].yy) i++;
	        j++;
	    }
	    else {
	        B[j].yy-=A[i].yy;
	        if(!B[j].yy) j++;
	        i++;
	    }
	}
	if(j==sz(B)) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


/*
 * Bidhan Roy
 * University of Dhaka
 */

using namespace std;

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <ctime>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)
#define inf (1<<30)
#define eps 1e-9
#define pb push_back
#define ins insert
#define mp make_pair
#define sz(x) ((int)x.size())
#define clr clear()
#define all(x) x.begin(),x.end()
#define xx first
#define yy second
#define sqr(x) ((x)*(x))
#define mem(x,val) memset((x),(val),sizeof(x));
#define read(x) freopen(x,"r",stdin);
#define rite(x) freopen(x,"w",stdout);

template <class T> inline T __in() { T v; cin>>v; return v; }

#define Q __in<int>()
#define QQ __in<i64>()
#define QS __in<st>()

typedef long long i64;
typedef unsigned long long ui64;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
typedef map<int,int> mii;
typedef map<st,int> msi;
typedef map<int,st> mis;
typedef set<int> si;
typedef set<st> ss;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define mx 0

int main(){
    ios_base::sync_with_stdio(0);
    int n=Q, m=Q, k=Q;
    mii aa, bb;
    rep(i,n) aa[Q]++;
    rep(j,m) bb[Q]++;
    foreach(it,aa){
        int am=it->yy;
        am=min(am,bb[it->xx]);
        aa[it->xx]-=am;
        bb[it->xx]-=am;
    }
    vpii A,B;
    foreach(it,aa){
        if(!it->yy) continue;
        A.pb(*it);
    }
    foreach(it,bb){
        if(!it->yy) continue;
        //cout<<it->xx<<" "<<it->yy<<endl;
        B.pb(*it);
    }
    //cout<<sz(A)<<" "<<sz(B)<<endl;
    sort(all(A));
    sort(all(B));
    if(A==B){
        cout<<"NO"<<endl;
        return 0;
    }
    int i=0,j=0;
    int sm=0;
    while(i<sz(A) && j<sz(B)){
        if(A[i].xx>B[j].xx) j++;
        else if(A[i].xx<B[j].xx && A[i].yy>=B[j].yy){
            A[i].yy-=B[j].yy;
            if(!A[i].yy) i++;
            j++;
        }
        else {
            B[j].yy-=A[i].yy;
            if(!B[j].yy) j++;
            i++;
        }
    }
    if(j==sz(B) && i<sz(A)) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


/*
 * Bidhan Roy
 * University of Dhaka
 */

using namespace std;

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <ctime>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)
#define inf (1<<30)
#define eps 1e-9
#define pb push_back
#define ins insert
#define mp make_pair
#define sz(x) ((int)x.size())
#define clr clear()
#define all(x) x.begin(),x.end()
#define xx first
#define yy second
#define sqr(x) ((x)*(x))
#define mem(x,val) memset((x),(val),sizeof(x));
#define read(x) freopen(x,"r",stdin);
#define rite(x) freopen(x,"w",stdout);

template <class T> inline T __in() { T v; cin>>v; return v; }

#define Q __in<int>()
#define QQ __in<i64>()
#define QS __in<st>()

typedef long long i64;
typedef unsigned long long ui64;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
typedef map<int,int> mii;
typedef map<st,int> msi;
typedef map<int,st> mis;
typedef set<int> si;
typedef set<st> ss;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define mx 2020
int tog[mx],one[mx];
int main(){
	ios_base::sync_with_stdio(0);
	st a=QS, b=QS;
	for(int i=sz(b)-1; i>=0; i--){
	    if(i==sz(b)-1) tog[i]=1;
	    else{
	        tog[i]=tog[i+1];
	        tog[i]+=(b[i]!=b[i+1]);
	    }
	}
	rep(i,sz(a)){
	    one[i]=(a[i]=='1');
	    if(i) one[i]+=one[i-1];
	}
	int cnt=0,ok=0;
	int curr=one[sz(a)-1]%2;
	for(int i=0; i<=sz(a); i++){
	    st aa=a.substr(sz(a)-i,i);
	    st bb=b.substr(0,i);
	    if(aa==bb){
	        //cout<<"i="<<i<<endl;
	        if(i==sz(b)){
	            ok=1;
	            break;
	        }
	        int need=b[i]-'0';
	        int tt=0;
	        if(sz(a)-i-1>=0) tt=one[sz(a)-i-1];
	        //cout<<tt<<endl;
	        int togg=tog[i];
	        //cout<<togg<<endl;
	        if(need==curr) togg--;
	        else togg+=(tog[i]>1);
	        if(togg<=tt){
	            ok=1;
	            break;
	        }
	    }
	    //else break;
	}
	if(ok) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;

}


/*
 * Bidhan Roy
 * University of Dhaka
 */

using namespace std;

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <ctime>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)
#define inf (1<<30)
#define eps 1e-9
#define pb push_back
#define ins insert
#define mp make_pair
#define sz(x) ((int)x.size())
#define clr clear()
#define all(x) x.begin(),x.end()
#define xx first
#define yy second
#define sqr(x) ((x)*(x))
#define mem(x,val) memset((x),(val),sizeof(x));
#define read(x) freopen(x,"r",stdin);
#define rite(x) freopen(x,"w",stdout);

template <class T> inline T __in() { T v; cin>>v; return v; }

#define Q __in<int>()
#define QQ __in<i64>()
#define QS __in<st>()

typedef long long i64;
typedef unsigned long long ui64;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
typedef map<int,int> mii;
typedef map<st,int> msi;
typedef map<int,st> mis;
typedef set<int> si;
typedef set<st> ss;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define mx 0

int main(){
	ios_base::sync_with_stdio(0);
	int n=Q, m=Q, k=Q;
	mii aa, bb;
	rep(i,n) aa[Q]++;
	rep(j,m) bb[Q]++;
	foreach(it,aa){
	    int am=it->yy;
	    am=min(am,bb[it->xx]);
	    aa[it->xx]-=am;
	    bb[it->xx]-=am;
	}
	vpii A,B;
	foreach(it,aa){
	    if(!it->yy) continue;
	    A.pb(*it);
	}
	foreach(it,bb){
	    if(!it->yy) continue;
	    //cout<<it->xx<<" "<<it->yy<<endl;
	    B.pb(*it);
	}
	//cout<<sz(A)<<" "<<sz(B)<<endl;
	int i=0,j=0;
	int sm=0;
	while(i<sz(A) && j<sz(B)){
	    if(A[i].xx>B[j].xx) j++;
	    else if(A[i].xx<B[j].xx && A[i].yy>=B[j].yy){
	        A[i].yy-=B[j].yy;
	        j++;
	    }
	    else {
	        B[j].yy-=A[i].yy;
	        i++;
	    }
	}
	if(j==sz(B)) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;
int main()
{
long n,m,k,sum1=0,sum2=0;
 cin>>n>>m>>k;
 int alix[1000];
 int bob[1000];
 for(int i=0;i<n;i++)
 {
     cin>>alix[i];
 sum1+=alix[i];
 }
 for(int i=0;i<m;i++)
 {
     cin>>bob[i];
 sum2+=bob[i];
 }
 if(sum1>sum2)cout<<"YES"<<endl;
 else
     cout<<"NO"<<endl;

}


#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;
int main()
{
long long  n,m,k,sum1=0,sum2=0;
 cin>>n>>m>>k;
 long  alix[100000];
 long  bob[100000];
 for(int i=0;i<n;i++)
 {
     cin>>alix[i];
 sum1+=alix[i];
 }
 for(int i=0;i<m;i++)
 {
     cin>>bob[i];
 sum2+=bob[i];
 }
 if(sum1>sum2)cout<<"YES"<<endl;
 else
     cout<<"NO"<<endl;

}


#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;
int main()
{
long   n,m,k;
    long long sum1=0;
    long long sum2=0;
 cin>>n>>m>>k;
 long  alix[100000];
 long  bob[100000];
 for(int i=0;i<n;i++)
 {
     cin>>alix[i];
 sum1+=alix[i];
 }
 for(int i=0;i<m;i++)
 {
     cin>>bob[i];
 sum2+=bob[i];
 }
 if(sum1>sum2)cout<<"YES"<<endl;
 else
     cout<<"NO"<<endl;

}


#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;
int main()
{
long long  n,m,k,sum1=0,sum2=0;
 cin>>n>>m>>k;
 long alix[1000000000];
 long bob[1000000000];
 for(int i=0;i<n;i++)
 {
     cin>>alix[i];
 sum1+=alix[i];
 }
 for(int i=0;i<m;i++)
 {
     cin>>bob[i];
 sum2+=bob[i];
 }
 if(sum1>sum2)cout<<"YES"<<endl;
 else
     cout<<"NO"<<endl;

}


#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <iomanip>

 #include <stdint.h>
using namespace std;
int main()
{

int64_t n, m, k;
    int64_t sum2=0;
    int64_t sum1=0;
 cin>>n>>m>>k;
vector<long>alix;
vector<long>bob;
 for(int i=0;i<n;i++)
 {
     cin>>alix[i];
 sum1+=alix[i];
 }
 for(int i=0;i<m;i++)
 {
     cin>>bob[i];
 sum2+=bob[i];
 }
 if(sum1>sum2)cout<<"YES"<<endl;
 else
     cout<<"NO"<<endl;

}


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <map>
#include <vector>
#include <cstdio>
#include <cmath>

#define X first
#define Y second

using namespace std;
map <int,bool> has;
int main(){

 long long int n,m,k,x,y;
 cin>>n>>m>>k;
 int c=0;
  vector<long long int>alice(n);
   vector<long long int>bob(m);
   for (int i = 0; i < n; i++)
   {
       cin>>alice[i];
       has[alice[i]]=1;

   }
    for (int i = 0; i < m; i++)
   {
       cin>>bob[i];
       if(has[bob[i]])++c;

   }
    if(n>m){cout<<"YES";return 0;}
    if(c>=n&&n<m){cout<<"NO";return 0;}
    sort(alice.rbegin(), alice.rend() );
    sort(bob.rbegin(), bob.rend());
    for(int i=0; i< n;i++) {
        if (alice[i] > bob[i]) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <utility>
using namespace std;

vector<int> a;
vector<int> b;
vector<char> merge;
int n,m,k;

string solve () {
    int i,j; i = j = 0;
    while(i < n and j < m) {
        if (a[i] < b[j]) {
            merge.push_back('A');
            ++i;
        }
        else if (a[i] > b[j]) {
            merge.push_back('B');
            ++j;
        }
        else {
            ++i; ++j;
        }
    }
    while(i < n) {
        merge.push_back('A');
        ++i;
    }
    while(j < m) {
        merge.push_back('B');
        ++j;
    }
    int k;
   // for (int l = 0; l < merge.size(); ++l) cout<<merge[l]<<endl;
    int sum = 0;
    for (k = merge.size()-1; k >= 0; --k) {
        if (merge[k] == 'A') {
            sum++;
        }
        else {
            sum--;
        }
     //   cout<<sum<<endl;
        if (sum >= 0) {
            return "YES";
        }
    }
    return "NO";
}

int main () {
    cin>>n>>m;
    a.reserve(n); b.reserve(m);
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    for (int j = 0; j < m; ++j){
        cin>>b[j];
    }
    cout<<solve()<<endl;
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

vector<int> a;
vector<int> b;
vector<char> merg;
int n,m,k;

string solve () {
    sort(a.begin(),a.end()); sort(b.begin(),b.end());
    int i,j; i = j = 0;
    while(i < n and j < m) {
        cout<<i<<","<<j<<endl<<"["<<a[i]<<","<<b[j]<<"]\n";
        if (a[i] < b[j]) {
            merg.push_back('A');
            ++i;
        }
        else if (a[i] > b[j]) {
            merg.push_back('B');
            ++j;
        }
        else {
            ++i; ++j;
        }
    }
    while(i < n) {
        merg.push_back('A');
        ++i;
    }
    while(j < m) {
        merg.push_back('B');
        ++j;
    }
    int k;
  //  for (int l = 0; l < merg.size(); ++l) cout<<merg[l]<<endl;
    int sum = 0;
    for (k = merg.size()-1; k >= 0; --k) {
        if (merg[k] == 'A') {
            sum++;
        }
        else {
            sum--;
        }
 //       cout<<sum<<endl;
        if (sum >= 0) {
            return "YES";
        }
    }
    return "NO";
}

int main () {
    cin>>n>>m>>k;
    a.reserve(n); b.reserve(m);
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    for (int j = 0; j < m; ++j){
        cin>>b[j];
    }
    cout<<solve()<<endl;
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

vector<int> a;
vector<int> b;
vector<char> merg;
int n,m,k;

string solve () {
    sort(a.begin(),a.end()); sort(b.begin(),b.end());
    //cout<<"__"<<" "<<a.size()<<" "<<b.size()<<endl;
#ifdef DEBUG
	for (int l = 0; l < a.size(); ++l) cout<<a[l]<<" "; cout<<endl; for (int l = 0; l < b.size(); ++l) cout<<b[l]<<" ";cout<<endl;
#endif
    int i,j; i = j = 0;
    while(i < n and j < m) {
      //  cout<<i<<","<<j<<endl<<"["<<a[i]<<","<<b[j]<<"]\n";
        if (a[i] < b[j]) {
            merg.push_back('A');
            ++i;
        }
        else if (a[i] > b[j]) {
            merg.push_back('B');
            ++j;
        }
        else {
            ++i; ++j;
        }
    }
    while(i < n) {
        merg.push_back('A');
        ++i;
    }
    while(j < m) {
        merg.push_back('B');
        ++j;
    }
    int k;
#ifdef DEBUG
	for (int l = 0; l < merg.size(); ++l) cout<<merg[l]<<" ";cout<<endl;
#endif
    int sum = 0;

    for (k = merg.size()-1; k >= 0; --k) {
        if (merg[k] == 'A') {
            sum++;
        }
        else {
            sum--;
        }
  //      cout<<sum<<endl;
        if (sum > 0) {
            return "YES";
        }
    }
    return "NO";
}

int main () {
    cin>>n>>m>>k;
    a.resize(n); b.resize(m);
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    for (int j = 0; j < m; ++j){
        cin>>b[j];
    }
    cout<<solve()<<endl;
}


#include <iostream>
#include <vector>
#include <utility>
using namespace std;

vector<int> a;
vector<int> b;
vector<char> merge;
int n,m,k;

string solve () {
    int i,j; i = j = 0;
    while(i < n and j < m) {
        if (a[i] < b[j]) {
            merge.push_back('A');
            ++i;
        }
        else if (a[i] > b[j]) {
            merge.push_back('B');
            ++j;
        }
        else {
            ++i; ++j;
        }
    }
    while(i < n) {
        merge.push_back('A');
        ++i;
    }
    while(j < m) {
        merge.push_back('B');
        ++j;
    }
    int k;
    int sum = 0;
    for (k = merge.size()-1; k >= 0; --k) {
        if (merge[i] == 'A') {
            sum++;
        }
        else {
            sum--;
        }
        if (sum >= 0) {
            return "YES";
        }
    }
    return "NO";
}

int main () {
    cin>>n>>m;
    a.reserve(n); b.reserve(m);
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    for (int j = 0; j < m; ++j){
        cin>>b[j];
    }
    cout<<solve()<<endl;
}


#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

vector<int> a;
vector<int> b;
vector<char> merg;
int n,m,k;

string solve () {
    sort(a.begin(),a.end()); sort(b.begin(),b.end());
    int i,j; i = j = 0;
    while(i < n and j < m) {
      //  cout<<i<<","<<j<<endl<<"["<<a[i]<<","<<b[j]<<"]\n";
        if (a[i] < b[j]) {
            merg.push_back('A');
            ++i;
        }
        else if (a[i] > b[j]) {
            merg.push_back('B');
            ++j;
        }
        else {
            ++i; ++j;
        }
    }
    while(i < n) {
        merg.push_back('A');
        ++i;
    }
    while(j < m) {
        merg.push_back('B');
        ++j;
    }
    int k;
  //  for (int l = 0; l < merg.size(); ++l) cout<<merg[l]<<endl;
    int sum = 0;
    for (k = merg.size()-1; k >= 0; --k) {
        if (merg[k] == 'A') {
            sum++;
        }
        else {
            sum--;
        }
 //       cout<<sum<<endl;
        if (sum >= 0) {
            return "YES";
        }
    }
    return "NO";
}

int main () {
    cin>>n>>m>>k;
    a.reserve(n); b.reserve(m);
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    for (int j = 0; j < m; ++j){
        cin>>b[j];
    }
    cout<<solve()<<endl;
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	std::ios_base::sync_with_stdio(0);
	int i,j,k,n,m,l,x,y,x1,y1,suma=0,sumb=0;
	cin>>n>>m>>k;
	int a[n+5],b[m+5];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(i=0;i<m;i++)
	{
		cin>>b[i];
	}
	if(n>m)
	{
		cout<<"YES";
		return 0;
	}
	sort(a,a+n);
	sort(b,b+m);
	for(i=n-1,j=m-1;i>=0 && j>=0;i--,j--)
	{
		if(b[j]<a[i])
		{
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	long long int i,j,k,n,m,l,x,y,x1,y1,suma=0,sumb=0;
	cin>>n>>m>>k;
	long long int a[n+5],b[m+5];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		suma+=a[i];
	}
	for(i=0;i<m;i++)
	{
		cin>>b[i];
		sumb+=b[i];
	}
	if(suma>sumb)
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	long long int i,j,k,n,m,l,x,y,x1,y1,suma=0,sumb=0;
	cin>>n>>m>>k;
	long long int a[n+5],b[m+5];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(i=0;i<m;i++)
	{
		cin>>b[i];
	}
	if(n>m)
	{
		cout<<"YES";
		return 0;
	}
	sort(a,a+n);
	sort(b,b+m);
	for(i=n-1,j=m-1;i>=0;i--,j--)
	{
		if(b[j]<a[i])
		{
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	int i,j,k,n,m,l,x,y,x1,y1,suma=0,sumb=0;
	cin>>n>>m>>k;
	int a[n+5],b[m+5];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		suma+=a[i];
	}
	for(i=0;i<m;i++)
	{
		cin>>b[i];
		sumb+=b[i];
	}
	if(suma>sumb)
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
}


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

using namespace std;

const int N = 111111;
int A[N], B[N];
int n, m;

int main()
{
    int i, j;
    int k, b, num;
    while(cin >> n >> m >> k)
    {
        num = 0;
        for(i = 0; i < n; i ++) cin >> A[i];
        sort(A, A + n);
        for(i = 0; i < m; i ++) cin >> B[i];
        sort(B, B + m);
        i = n; j = m;
        while (i && j)
        {
            --i;
            --j;
            if (A[i] > B[j])
            {
                puts ("YES");
                num = 1;
                break;
            }
        }
        if(num) continue;
        puts (i ? "YES" : "NO");

    }
}


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

using namespace std;

const int N = 111111;
long long A[N], B[N];
long long A2[N];
int mark[N];
int n, m;

int bys(long long q)
{
    int l = 0, r = n - 1, m;
    while(l <= r)
    {
        m = (r + l) >> 1;
        if(A[m] == q)
        {
            if(mark[m])
            {
                mark[m] --;
                return m;
            }
            else return -1;
        }
        else if(A[m] < q) l = m + 1;
        else r = m - 1;
    }
    return -1;
}

int main()
{
    int i, j, num;
    long long k, b, suma, sumb;
    while(cin >> n >> m >> k)
    {
        suma = 0; sumb = 0;
        memset(mark, 0, sizeof(mark));
        memset(A2, 0, sizeof(A2));
        for(int i = 0; i < n; i ++)
        {
            cin >> A2[i];
            suma += A2[i];
        }
        sort(A2, A2 + n);
        A[0] = A2[0];
        mark[0] ++;
        for(i = 1, j = 1; i < n; i ++)
        {
            if(A2[i] == A[j - 1])
            {
                mark[j - 1] ++;
            }
            else
            {
                A[j] = A2[i];
                mark[j] ++;
                j ++;
            }
        }
        n = j;
        num = 0;
        for(i = 0; i < m; i ++)
        {
            cin >> b;
            sumb += b;
            j = bys(b);
            //cout << j << endl;
            if(j != -1)
            {
                suma -= b;
                sumb -= b;
                num ++;
                //cout << suma << endl;
            }
        }
        //cout << suma << " " << sumb - m + num << endl;
        if(suma <= sumb - m + num) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
}


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

using namespace std;

const int N = 111111;
int A[N], B[N];
int A2[N];
int mark[N];
int n;

int bys(int q)
{
    int l = 0, r = n - 1, m;
    while(l <= r)
    {
        m = (r + l) >> 1;
        if(A[m] == q) return m;
        else if(A[m] < q) l = m + 1;
        else r = m - 1;
    }
    return r;
}

int main()
{
    int i, j, num, m;
    int k, b, suma, sumb;
    while(cin >> n >> m >> k)
    {
        suma = 0; sumb = 0;
        memset(mark, 0, sizeof(mark));
        memset(A2, 0, sizeof(A2));
        for(int i = 0; i < n; i ++)
        {
            cin >> A2[i];
            suma += A2[i];
        }
        sort(A2, A2 + n);
        //for(int i = 0; i < n; i ++) cout <<A2[i] << " ";
        A[0] = A2[0];mark[0] ++;
        for(i = 1, j = 1; i < n; i ++)
        {
            if(A2[i] == A[j - 1])
            {
                mark[j - 1] ++;
            }
            else
            {
                A[j] = A2[i];
                mark[j] ++;
                j ++;
            }
        }
        n = j;
        num = 0;
        for(i = 0; i < m; i ++)
        {
            cin >> b;
            //B[i] = b;
            j = bys(b);
            if(j >= 0 && A[j] == b && mark[j])
            {
                mark[j] --;
                suma -= b;
                num ++;
            }
            else if(j >= 0 && A[j] == b && !mark[j])
            {
                sumb += A[j - 1];
            }
            else if(j >= 0 && A[j] != b)
            {
                sumb += A[j];
                //cout << sumb << endl;
                //cout << A[j] << ":" << j << endl;
            }
        }
        //sort(B, B + m);
        //for(int i = 0; i < m; i ++)cout <<B[i] << " ";
        //cout << endl;
        //cout << suma << " " << sumb << endl;
        if(suma <= sumb) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
}


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

using namespace std;

const int N = 111111;
int A[N], B[N];
int n, m;

int main()
{
    int i, j;
    int k, b, num;
    while(cin >> n >> m >> k)
    {
        for(i = 0; i < n; i ++) cin >> A[i];
        sort(A, A + n);
        for(i = 0; i < m; i ++) cin >> B[i];
        sort(B, B + m);
        for(i = n - 1, j = m - 1; i >= 0, j >= 0; i --, j --)
        {
            if(A[i] > B[j])
            {
                cout << "YES" << endl;
                continue ;
            }
        }
        if(i >= 0) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}


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

using namespace std;

const int N = 111111;
int A[N], B[N];
int A2[N];
int mark[N];
int n;

int bys(int q)
{
    int l = 0, r = n - 1, m;
    while(l <= r)
    {
        m = (r + l) >> 1;
        if(A[m] == q) return m;
        else if(A[m] < q) l = m + 1;
        else r = m - 1;
    }
    return r;
}

int main()
{
    int i, j, num, m;
    int k, b, suma, sumb;
    while(cin >> n >> m >> k)
    {
        suma = 0; sumb = 0;
        memset(mark, 0, sizeof(mark));
        memset(A2, 0, sizeof(A2));
        for(int i = 0; i < n; i ++)
        {
            cin >> A2[i];
            suma += A2[i];
        }
        sort(A2, A2 + n);
        //for(int i = 0; i < n; i ++) cout <<A2[i] << " ";
        A[0] = A2[0];mark[0] ++;
        for(i = 1, j = 1; i < n; i ++)
        {
            if(A2[i] == A[j - 1])
            {
                mark[j - 1] ++;
            }
            else
            {
                A[j] = A2[i];
                mark[j] ++;
                j ++;
            }
        }
        n = j;
        num = 0;
        for(i = 0; i < m; i ++)
        {
            cin >> b;
            //B[i] = b;
            j = bys(b);
            if(j >= 0 && A[j] == b && mark[j])
            {
                mark[j] --;
                suma -= b;
                num ++;
            }
            else if(j >= 0 && A[j] == b && !mark[j])
            {
                sumb += A[j - 1];
            }
            else if(j >= 0 && A[j] != b)
            {
                sumb += A[j];
                //cout << sumb << endl;
                cout << A[j] << ":" << j << endl;
            }
        }
        //sort(B, B + m);
        //for(int i = 0; i < m; i ++)cout <<B[i] << " ";
        //cout << endl;
        //cout << suma << " " << sumb << endl;
        if(suma <= sumb) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
}


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

using namespace std;

const int N = 111111;
int A[N], B[N];
int A2[N];
int mark[N];
int n;

int bys(int q)
{
    int l = 0, r = n - 1, m;
    while(l <= r)
    {
        m = (r + l) >> 1;
        if(A[m] == q) return m;
        else if(A[m] < q) l = m + 1;
        else r = m - 1;
    }
    return r;
}

int main()
{
    int i, j, num, m;
    int k, b, suma, sumb;
    while(cin >> n >> m >> k)
    {
        suma = 0; sumb = 0;
        memset(mark, 0, sizeof(mark));
        memset(A2, 0, sizeof(A2));
        for(int i = 0; i < n; i ++)
        {
            cin >> A2[i];
            suma += A2[i];
        }
        sort(A2, A2 + n);
        A[0] = A2[0];
        for(i = 1, j = 1; i < n; i ++)
        {
            if(A2[i] == A[j - 1])
            {
                mark[j - 1] ++;
            }
            else
            {
                A[j] = A2[i];
                mark[j] ++;
                j ++;
            }
        }
        n = j;
        num = 0;
        for(i = 0; i < m; i ++)
        {
            cin >> b;
            j = bys(b);
            if(A[j] == b && mark[j])
            {
                mark[j] --;
                suma -= b;
                num ++;
            }
            else if(A[j] != b)
            {
                sumb += A[j];
                //cout << A[j] << endl;
            }
        }
        if(suma <= sumb) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
}


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

using namespace std;

const int N = 111111;
long long A[N], B[N];
long long A2[N];
int mark[N];
int n;

int bys(long long q)
{
    int l = 0, r = n - 1, m;
    while(l <= r)
    {
        m = (r + l) >> 1;
        if(A[m] == q) return m;
        else if(A[m] < q) l = m + 1;
        else r = m - 1;
    }
    return r;
}

int main()
{
    int i, j, num, m;
    long long k, b, suma, sumb;
    while(cin >> n >> m >> k)
    {
        suma = 0; sumb = 0;
        memset(mark, 0, sizeof(mark));
        memset(A2, 0, sizeof(A2));
        for(i = 0; i < n; i ++)
        {
            cin >> A2[i];
            suma += A2[i];
        }
        sort(A2, A2 + n);
        A[0] = A2[0];mark[0] ++;
        for(i = 1, j = 1; i < n; i ++)
        {
            if(A2[i] == A[j - 1])
            {
                mark[j - 1] ++;
            }
            else
            {
                A[j] = A2[i];
                mark[j] ++;
                j ++;
            }
        }
        n = j;
        num = 0;
        for(i = 0; i < m; i ++)
        {
            cin >> b;
            j = bys(b);
            if(j >= 0 && A[j] == b && mark[j])
            {
                mark[j] --;
                suma -= b;
                num ++;
            }
            else if(j >= 0 && A[j] == b && !mark[j])
            {
                sumb += A[j - 1];
            }
            else if(j >= 0 && A[j] != b)
            {
                sumb += A[j];
            }
        }
        if(suma <= sumb) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
}


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

using namespace std;

const int N = 111111;
int A[N], B[N];
int A2[N];
int mark[N];
int n;

int bys(int q)
{
    int l = 0, r = n - 1, m;
    while(l <= r)
    {
        m = (r + l) >> 1;
        if(A[m] == q) return m;
        else if(A[m] < q) l = m + 1;
        else r = m - 1;
    }
    return r;
}

int main()
{
    int i, j, num, m;
    int k, b, suma, sumb;
    while(cin >> n >> m >> k)
    {
        suma = 0; sumb = 0;
        memset(mark, 0, sizeof(mark));
        memset(A2, 0, sizeof(A2));
        for(int i = 0; i < n; i ++)
        {
            cin >> A2[i];
            suma += A2[i];
        }
        sort(A2, A2 + n);
        A[0] = A2[0];
        for(i = 1, j = 1; i < n; i ++)
        {
            if(A2[i] == A[j - 1])
            {
                mark[j - 1] ++;
            }
            else
            {
                A[j] = A2[i];
                mark[j] ++;
                j ++;
            }
        }
        n = j;
        num = 0;
        for(i = 0; i < m; i ++)
        {
            cin >> b;
            j = bys(b);
            if(j >= 0 && A[j] == b && mark[j])
            {
                mark[j] --;
                suma -= b;
                num ++;
            }
            else if(j >= 0 && A[j] != b)
            {
                sumb += A[j];
                //cout << A[j] << ":" << j << endl;
            }
        }
        if(suma <= sumb) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
}


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

using namespace std;

const int N = 111111;
int A[N], B[N];
int A2[N];
int mark[N];
int n, m;

int bys(int q)
{
    int l = 0, r = n - 1, m;
    while(l <= r)
    {
        m = (r + l) >> 1;
        if(A[m] == q)
        {
            if(mark[m])
            {
                mark[m] --;
                return m;
            }
            else return -1;
        }
        else if(A[m] < q) l = m + 1;
        else r = m - 1;
    }
    return -1;
}

int main()
{
    int i, j, num;
    int k, b, suma, sumb;
    while(cin >> n >> m >> k)
    {
        suma = 0; sumb = 0;
        memset(mark, 0, sizeof(mark));
        memset(A2, 0, sizeof(A2));
        for(int i = 0; i < n; i ++)
        {
            cin >> A2[i];
            suma += A2[i];
        }
        sort(A2, A2 + n);
        A[0] = A2[0];
        mark[0] ++;
        for(i = 1, j = 1; i < n; i ++)
        {
            if(A2[i] == A[j - 1])
            {
                mark[j - 1] ++;
            }
            else
            {
                A[j] = A2[i];
                mark[j] ++;
                j ++;
            }
        }
        n = j;
        num = 0;
        for(i = 0; i < m; i ++)
        {
            cin >> b;
            sumb += b;
            j = bys(b);
            //cout << j << endl;
            if(j != -1)
            {
                suma -= b;
                sumb -= b;
                num ++;
                //cout << suma << endl;
            }
        }
        //cout << suma << " " << sumb - m + num << endl;
        if(suma <= sumb - m + num) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
}


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

using namespace std;

const int N = 111111;
int A[N], B[N];
int n, m;

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


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

using namespace std;

const int N = 111111;
int A[N], B[N];
int n, m;

int main()
{
    int i, j;
    int k, b, num;
    while(cin >> n >> m >> k)
    {
        num = 0;
        for(i = 0; i < n; i ++) cin >> A[i];
        sort(A, A + n);
        for(i = 0; i < m; i ++) cin >> B[i];
        sort(B, B + m);
        for(i = n - 1, j = m - 1; i >= 0, j >= 0; i --, j --)
        {
            if(A[i] > B[j])
            {
                cout << "YES" << endl;
                num = 1;
                break;
            }
        }
        if(num) continue ;
        if(i >= 0) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}


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

using namespace std;

const int N = 111111;
long long A[N], B[N];
long long A2[N];
int mark[N];
int n, m;

int bys(int q)
{
    int l = 0, r = n - 1, m;
    while(l <= r)
    {
        m = (r + l) >> 1;
        if(A[m] == q)
        {
            if(mark[m])
            {
                mark[m] --;
                return m;
            }
            else return -1;
        }
        else if(A[m] < q) l = m + 1;
        else r = m - 1;
    }
    return -1;
}

int main()
{
    int i, j, num;
    long long k, b, suma, sumb;
    while(cin >> n >> m >> k)
    {
        suma = 0; sumb = 0;
        memset(mark, 0, sizeof(mark));
        memset(A2, 0, sizeof(A2));
        for(int i = 0; i < n; i ++)
        {
            cin >> A2[i];
            suma += A2[i];
        }
        sort(A2, A2 + n);
        A[0] = A2[0];
        mark[0] ++;
        for(i = 1, j = 1; i < n; i ++)
        {
            if(A2[i] == A[j - 1])
            {
                mark[j - 1] ++;
            }
            else
            {
                A[j] = A2[i];
                mark[j] ++;
                j ++;
            }
        }
        n = j;
        num = 0;
        for(i = 0; i < m; i ++)
        {
            cin >> b;
            sumb += b;
            j = bys(b);
            //cout << j << endl;
            if(j != -1)
            {
                suma -= b;
                sumb -= b;
                num ++;
                //cout << suma << endl;
            }
        }
        //cout << suma << " " << sumb - m + num << endl;
        if(suma <= sumb - m + num) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
}


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

using namespace std;

const int N = 111111;
int A[N], B[N];
int A2[N];
int mark[N];
int n, m;

int bys(int q)
{
    int l = 0, r = n - 1, m;
    while(l <= r)
    {
        m = (r + l) >> 1;
        if(A[m] == q)
        {
            if(mark[m])
            {
                mark[m] --;
                return m;
            }
            else return -1;
        }
        else if(A[m] < q) l = m + 1;
        else r = m - 1;
    }
    return -1;
}

int main()
{
    int i, j, num;
    int k, b, suma, sumb;
    while(cin >> n >> m >> k)
    {
        suma = 0; sumb = 0;
        memset(mark, 0, sizeof(mark));
        memset(A2, 0, sizeof(A2));
        for(int i = 0; i < n; i ++)
        {
            cin >> A2[i];
            suma += A2[i];
        }
        sort(A2, A2 + n);
        A[0] = A2[0];
        for(i = 1, j = 1; i < n; i ++)
        {
            if(A2[i] == A[j - 1])
            {
                mark[j - 1] ++;
            }
            else
            {
                A[j] = A2[i];
                mark[j] ++;
                j ++;
            }
        }
        n = j;
        num = 0;
        for(i = 0; i < m; i ++)
        {
            cin >> b;
            sumb += b;
            j = bys(b);
            if(j != -1)
            {
                suma -= b;
                sumb -= b;
                num ++;
            }
        }
        if(suma <= sumb - m + num) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
}


// In the name of God

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <complex>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <ctime>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
typedef pair<int,int> pii;

int main()
{
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll>a;
	vector<ll>b;
	a.resize(n+1);
	b.resize(n+1);
	for(int i=0; i<n; i++)
		cin>>a[i];
	for(int i=0; i<m; i++)
		cin>>b[i];
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	if(n>m){
		cout<<"YES"<<endl;
		return 0;
	}
	int i=n-1;
	int j=m-1;
	while(i>0 && j>0){
		if(a[i]>b[j]){
			cout<<"YES"<<endl;
			return 0;
		}
		else {
			i--;
			j--;
		}
	}
	cout<<"NO"<<endl;

	return 0;
}


// In the name of God

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <complex>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <ctime>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
typedef pair<int,int> pii;

int main()
{
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll>a;
	vector<ll>b;
	a.resize(n);
	b.resize(m);
	for(int i=0; i<n; i++)
		cin>>a[i];
	for(int i=0; i<m; i++)
		cin>>b[i];

	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	if(n>m){
		cout<<"YES"<<endl;
		return 0;
	}
	int i=n-1;
	int j=m-1;
	while(i>0 && j>0){
		if(a[i]>b[j]){
			cout<<"YES"<<endl;
			return 0;
		}
		else {
			i--;
			j--;
		}
	}
	cout<<"NO"<<endl;

	return 0;
}


// In the name of God

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <complex>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <ctime>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
typedef pair<int,int> pii;

int main()
{
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll>a;
	vector<ll>b;
	a.resize(n);
	b.resize(m);
	for(int i=0; i<n; i++)
		cin>>a[i];
	for(int i=0; i<m; i++)
		cin>>b[i];

	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	if(n>m){
		cout<<"YES"<<endl;
		return 0;
	}
	int i=n-1;
	int j=m-1;
	while(i>=0 && j>=0){
		if(a[i]>b[j]){
			cout<<"YES"<<endl;
			return 0;
		}
		else {
			i--;
			j--;
		}
	}
	cout<<"NO"<<endl;

	return 0;
}


// In the name of God

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <complex>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <ctime>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
typedef pair<int,int> pii;

int main()
{
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll>a;
	vector<ll>b;
	a.resize(n);
	b.resize(n);
	for(int i=0; i<n; i++)
		cin>>a[i];
	for(int i=0; i<m; i++)
		cin>>b[i];
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	if(n>m){
		cout<<"YES"<<endl;
		return 0;
	}
	int i=n-1;
	int j=m-1;
	while(i>0 && j>0){
		if(a[i]>b[j]){
			cout<<"YES"<<endl;
			return 0;
		}
		else {
			i--;
			j--;
		}
	}
	cout<<"NO"<<endl;

	return 0;
}


#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <sstream>
#include <string>
#include <cstring>
#include <utility>
using namespace std;
int n,m,k,x;
map <int,int> mp;
int main()
{
	cin>>n>>m>>k;
	for (int i=1;i<=n;i++)
	{
		cin>>x;
		mp[x]++;
	}
	for (int i=1;i<=m;i++)
	{
		cin>>x;
		mp[x]--;
	}
	for (int i=1;i<=k;i++)
	{
		if (mp[i]>0) {cout<<"YES";return 0;}
	}
	cout<<"NO";
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <sstream>
#include <string>
#include <cstring>
#include <utility>
using namespace std;
int n,m,k,x;
map <int,int> mp;
double res,ans;
int main()
{
	cin>>n>>m>>k;
	for (int i=1;i<=n;i++)
	{
		cin>>x;
		mp[x]+=1;
	}
	for (int i=1;i<=m;i++)
	{
		cin>>x;
		mp[x]-=1;
	}
	res=1;
	for (int i=1;i<=k;i++)
	{
		ans+=res*mp[i];
		res*=2;
	}
	if (ans<0) cout<<"NO"; else cout<<"YES";
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <sstream>
#include <string>
#include <cstring>
#include <utility>
using namespace std;
int n,m,k,x;
int a[100005],b[100005];
int main()
{
	cin>>n>>m>>k;
	if (n>m)
	{
		cout<<"YES";
		return 0;
	}
	for (int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for (int i=1;i<=m;i++)
	{
		cin>>b[i];
	}
	sort(a+1,a+1+n);
	sort(b+1,b+1+m);
	reverse(a+1,a+1+n);
	reverse(b+1,b+1+m);
	for (int i=1;i<=min(n,m);i++)
	{
		if (a[i]>b[i]) {cout<<"YES";return 0;}
	}
	cout<<"NO";
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <list>
#include <sstream>
#include <string>
#include <cstring>
#include <utility>
using namespace std;
int n,m,k,x;
int a[100005],b[100005];
int main()
{
	cin>>n>>m>>k;
	if (n>m)
	{
		puts("YES");
		return 0;
	}
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for (int i=1;i<=m;i++)
	{
		scanf("%d",&b[i]);
	}
	sort(a+1,a+1+n);
	sort(b+1,b+1+m);
	reverse(a+1,a+1+n);
	reverse(b+1,b+1+m);
	int mi=min(n,m);
	for (int i=1;i<=mi;i++)
	{
		if (a[i]>b[i]) {puts("YES");return 0;}
	}
	puts("NO");
	return 0;
}


#include <iostream>
#include <valarray>
using namespace std;

int main() {
	double n,m,k,t;
	string str;
	cin>>n>>m>>k;
	valarray<double> vn(n);
	valarray<double> vm(m);
	for (int i = 0; i < n; ++i) {
		cin>>t;
		vn[i] = t/k;
	}
	for (int i = 0; i < m; ++i) {
		cin>>t;
		vm[i] = t/k;
	}
	cout << (vn.sum() > vm.sum() ? "YES" : "NO") << endl;
	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main() {

	int n,m,k,t;

	cin >> n >> m >> k;

	int* pn = new int[n];
	int* pm = new int[m];

	for (int i = 0; i < n; cin >> pn[i], ++i);
	for (int i = 0; i < m; cin >> pm[i], ++i);

	sort(pn, pn+n);
	sort(pm, pm+m);
	for (int i = 0; i < n; ++i) {
		if (pm + m - lower_bound(pm, pm+m, pn[i]) < n - i) {
			cout << "YES";
			return 0;
		}
	}
	cout << "NO"<< endl;

	delete[] pn;
	delete[] pm;

	return 0;
}


#include <iostream>
#include <valarray>
using namespace std;

int main() {
	int n,m,k,t;
	string str;
	cin>>n>>m>>k;
	valarray<double> vn(n);
	valarray<double> vm(m);
	for (int i = 0; i < n; ++i) {
		cin>>t;
		vn[i] = t;
	}
	for (int i = 0; i < m; ++i) {
		cin>>t;
		vm[i] = t;
	}
	cout << (vn.sum() > vm.sum() ? "YES" : "NO") << endl;
	return 0;
}


#include <iostream>
#include <valarray>
using namespace std;

int main() {
	int n,m,k,t;
	string str;
	cin>>n>>m>>k;
	valarray<unsigned long long> vn(n);
	valarray<unsigned long long> vm(m);
	for (int i = 0; i < n; ++i) {
		cin>>t;
		vn[i] = t;
	}
	for (int i = 0; i < m; ++i) {
		cin>>t;
		vm[i] = t;
	}
	vn -= vm;
	cout << (vn.sum() > 0 ? "YES" : "NO") << endl;
	return 0;
}


#include <iostream>
#include <valarray>
using namespace std;

int main() {
	int n,m,k,t;
	string str;
	cin>>n>>m>>k;
	valarray<int> vn(n);
	valarray<int> vm(m);
	for (int i = 0; i < n; ++i) {
		cin>>t;
		vn[i] = t;
	}
	for (int i = 0; i < m; ++i) {
		cin>>t;
		vm[i] = t;
	}
//	cout << vn.sum() << ' ' << vm.sum() << endl;
	cout << (vn.sum() > vm.sum() ? "YES" : "NO") << endl;
	return 0;
}


#include <iostream>
#include <valarray>
using namespace std;

int main() {
	double n,m,k,t;
	string str;
	cin>>n>>m>>k;
	valarray<double> vn(n);
	valarray<double> vm(m);
	for (int i = 0; i < n; ++i) {
		cin>>t;
		vn[i] = t;
	}
	for (int i = 0; i < m; ++i) {
		cin>>t;
		vm[i] = t;
	}
	vn /= k;
	vm /= k;
	cout << (vn.sum() > vm.sum() ? "YES" : "NO") << endl;
	return 0;
}


#include <iostream>
#include <valarray>
using namespace std;

int main() {
	int n,m,k,t;
	string str;
	cin>>n>>m>>k;
	valarray<unsigned long long> vn(n);
	valarray<unsigned long long> vm(m);
	for (int i = 0; i < n; ++i) {
		cin>>t;
		vn[i] = t;
	}
	for (int i = 0; i < m; ++i) {
		cin>>t;
		vm[i] = t;
	}
	cout << (vn.sum() > vm.sum() ? "YES" : "NO") << endl;
	return 0;
}


//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <string>

#define MA 10000
using namespace std;

int main()
{
    int *a, *b;
    int n,m,k;

    cin>>n>>m>>k;

    a=  new int[n];
    b=  new int [m];

    for(int i=0;i<n;i++)
        cin>>a[i];

    for(int i=0;i<m;i++)
        cin>> b[i];

    int m1=a[0],m2=b[0];
    double s1=0,s2=0;

    for(int i=0;i<n;i++)
    {
        if(a[i]>m1) m1 = a[i];
        s1+=(a[i]+0.99);
    }

    for(int i=0;i<m;i++)
    {
        if(b[i]>m2) m2 = b[i];
        s2+=(b[i]);
    }

    int kt=2;

    if(n==m)
        for(int i=0;i<n;i++)
    {
        kt = 0;
        for(int j=0;j<m;j++)
            if(a[i]==b[j]) {kt = 1; b[j]=-1;}
        if(kt==0) {kt = 2;break;}
    }

    if(m!=n)
    if((n>m)||(m1>m2)||(s1>s2)||(kt!=2))
        cout<<"YES";
    else cout<<"NO";
    if(m==n)
        if(kt!=2) cout<<"YES";
        else cout<<"NO";

    delete []a;
    delete []b;

}


#include <iostream>
#include <string>

#define MA 10000
using namespace std;

int main()
{
    int *a, *b;
    int n,m,k;

    cin>>n>>m>>k;

    a=  new int[n];
    b=  new int [m];

    for(int i=0;i<n;i++)
        cin>>a[i];

    for(int i=0;i<m;i++)
        cin>> b[i];

    int m1=a[0],m2=b[0];
    double s1=0,s2=0;

    for(int i=0;i<n;i++)
    {
        if(a[i]>m1) m1 = a[i];
        s1+=(a[i]+0.99);
    }

    for(int i=0;i<m;i++)
    {
        if(b[i]>m2) m2 = b[i];
        s2+=(b[i]);
    }

    int kt=2;

    if(n==m)
        for(int i=0;i<n;i++)
    {
        kt = 0;
        for(int j=0;j<m;j++)
            if(a[i]==b[j]) {kt = 1; b[j]=-1;}
        if(kt==0) {kt = 2;break;}
    }

    if((n>k)||(m>k)) cout<<"NO";
    else
    if((n>m)||(m1>m2)||(s1>s2)||(kt!=2))
        cout<<"YES";
    else cout<<"NO";

    delete []a;
    delete []b;

}


//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <algorithm>

#define MA 10000
using namespace std;

typedef struct FISH{
    int x;
    int y;
} fish;

int cmp(fish a, fish b)
{
    if(a.x!=b.x)
        return a.x>b.x;
    else return a.y>b.y;
}

int main()
{
    fish *a, *b;
    int n,m,k;

    cin>>n>>m>>k;

    a=  new fish [n+1+m];

    for(int i=0;i<n;i++)
    {
        cin>>a[i].x ;
        a[i].y=1;
    }

    for(int i=n;i<m+n;i++)
    {
        cin>> a[i].x;
        a[i].y = -1;
    }

    sort(a,a+n+m,cmp);

    bool ok = false;
    int s=0;

    for(int i=0; i<n+m;i++)
    {
        s+=a[i].y;
        if((i==m+n-1)||(a[i].x!=a[i+1].x))
            if(s>0) ok  =1;
    }

    if(ok)
        cout<<"YES";
    else cout<<"NO";

    delete []a;

}


#include <iostream>
#include <string>

#define MA 10000
using namespace std;

int main()
{
    int *a, *b;
    int n,m,k;

    cin>>n>>m>>k;

    a=  new int[n];
    b=  new int [m];

    for(int i=0;i<n;i++)
        cin>>a[i];

    for(int i=0;i<m;i++)
        cin>> b[i];

    int m1=a[0],m2=b[0];
    double s1=0,s2=0;

    for(int i=0;i<n;i++)
    {
        if(a[i]>m1) m1 = a[i];
        s1+=(a[i]+0.99);
    }

    for(int i=0;i<m;i++)
    {
        if(b[i]>m2) m2 = b[i];
        s2+=(b[i]+0.99);
    }

    int kt;

    for(int i=0;i<n;i++)
    {
        kt = 0;
        for(int j=0;j<m;j++)
            if(a[i]==b[j]) kt = 1;
        if(kt==0) {kt = 2;break;}
    }

    if((n>m)||(m1>m2)||(s1>s2))
        cout<<"YES";
    else cout<<"NO";

    delete []a;
    delete []b;

}


//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <string>

#define MA 10000
using namespace std;

int main()
{
    int *a, *b;
    int n,m,k;

    cin>>n>>m>>k;

    a=  new int[n];
    b=  new int [m];

    for(int i=0;i<n;i++)
        cin>>a[i];

    for(int i=0;i<m;i++)
        cin>> b[i];

    int m1=a[0],m2=b[0];
    double s1=0,s2=0;

    for(int i=0;i<n;i++)
    {
        if(a[i]>m1) m1 = a[i];
        s1+=(a[i]+0.99);
    }

    for(int i=0;i<m;i++)
    {
        if(b[i]>m2) m2 = b[i];
        s2+=(b[i]);
    }

    int kt=2;

    if(n==m)
        for(int i=0;i<n;i++)
    {
        kt = 0;
        for(int j=0;j<m;j++)
            if(a[i]==b[j]) kt = 1;
        if(kt==0) {kt = 2;break;}
    }

    if((n>m)||(m1>m2)||(s1>s2)||(kt!=2))
        cout<<"YES";
    else cout<<"NO";

    delete []a;
    delete []b;

}


//http://codeforces.com/problemset/problem/297/B
#include <iostream>
#include <algorithm>

#define MA 10000
using namespace std;

typedef struct FISH{
    int x;
    int y;
} fish;

int cmp(fish a, fish b)
{
    if(a.x!=b.x)
        return a.x>b.x;
    else return a.y>b.y;
}

int main()
{
    fish *a, *b;
    int n,m,k;

    cin>>n>>m>>k;

    a=  new fish [n+1+m];

    for(int i=0;i<n;i++)
        cin>>a[i].x ;

    for(int i=n;i<m+n;i++)
        cin>> a[i].x;

    sort(a,a+n+m,cmp);

    bool ok = false;
    int s=0;

    for(int i=0; i<n+m;i++)
    {
        s+=a[i].y;
        if((i==m+n-1)||(a[i].x!=a[i+1].x))
            if(s>0) ok  =1;
    }

    if(ok)
        cout<<"YES";
    else cout<<"NO";

    delete []a;

}


#include<iostream>
#include <algorithm>
#include<string.h>
using namespace std;
int main()
{
    int n,m,k;
    int i,j;
    char a[100000];
    char b[100000];
    while(cin >> n >> m >> k)
    {
        memset(a,'0',sizeof(a));
        memset(b,'0',sizeof(b));
        for(i = 0; i < n ; i++)
            cin >> a[i];
        for(i = 0; i < m ; i++)
            cin >> b[i];
        sort(a,a+n);
        sort(b,b+m);
        i = 0;
        j = 0;
      while(i < n && j < m)
        {
            if(a[i] <= b[j])
            {
                i++;
                j++;
            }
            else
                j++;
        }
        if(i == n)
            cout << "NO" << endl;
        else
            cout << "YES"<<endl;
    }
    return 0;
}


#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    int n,m,k;
    int i,j;
    int flag;
    char a[100000];
    char b[100000];
    while(cin >> n >> m >> k)
    {
        flag = 0;
        memset(a,'0',sizeof(a));
        memset(b,'0',sizeof(b));
        for(i = 0; i < n ; i++)
            cin >> a[i];
        for(i = 0; i < m ; i++)
            cin >> b[i];
        if(n > m)
        {
            cout << "YES"<<endl;
            return 0;
        }
        for(i = 0; i < n; i++)
        {
            for(j = 0; j < m ; j++)
           {
            if(a[i] == b[j])
                flag = 1;
           }
           if(flag == 0)
           {
               cout << "YES" <<endl;
               return 0;
           }
        }
    cout << "NO" << endl;
    }
    return 0;
}


#include<iostream>
#include <algorithm>
#include<string.h>
using namespace std;
 char a[100000];
char b[100000];
int main()
{
    int n,m,k;
    int i,j;
    cin >> n >> m >> k;
        for(i = 0; i < n ; i++)
            cin >> a[i];
        for(i = 0; i < m ; i++)
            cin >> b[i];
        sort(a,a+n);
        sort(b,b+m);
        i = 0;
        j = 0;
      while(i < n && j < m)
        {
            if(a[i] <= b[j])i++,j++;
            else j++;
        }
        if(i == n)
            cout << "NO" << endl;
        else
            cout << "YES"<<endl;
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int maxn=100000+5;
int A[maxn],B[maxn];
int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)
        scanf("%d",&A[i]);
    for(int i=0;i<m;i++)
        scanf("%d",&B[i]);
    sort(A,A+n);
    sort(B,B+m);
    int j=0,i=0;
    while(i<n&&j<m)
    {
        if(A[i]<=B[j]) i++,j++;
        else j++;
    }
    if(i==n) cout<<"NO";
    else cout<<"YES";
    return 0;
}


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

using namespace std;
typedef long long ll;
vector<int> A,B;

int main(){
    int n,m,k;
    long long sumA=0LL, sumB=0LL;
    scanf("%d %d %d\n",&n,&m,&k);
    A.push_back(0);

    for(int i=0,temp;i<n;++i){
        scanf("%d",&temp);
        sumA+=(ll)temp;
        A.push_back(temp);
    }
    for(int i=0,temp;i<m;++i){
        scanf("%d",&temp);
        sumB+=(ll)temp;
        B.push_back(temp);
    }
    if(sumA>sumB){
        printf("YES\n");
        return 0;
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    int ida=n, idb=m-1;
    bool in=0;
/*
for(int i=0;i<A.size();++i) cout<<A[i]<<" ";
cout<<endl;
for(int i=0;i<B.size();++i) cout<<B[i]<<" ";
cout<<endl;
*/
    while( ida>=0 && idb>=0 ){

//printf("--ida:%d(%d)....idb:%d(%d)\n",ida,A[ida],idb,B[idb]);
        in=0;
        if(A[ida]==B[idb]){
            while(idb>=0 && A[ida]==B[--idb]);
            --ida;
            continue;
        }
        if(A[ida]>B[idb]){
            --ida;
            continue;
        }
        while(idb>=0 && A[ida]<=B[idb]){
            sumB-=(B[idb]-A[ida]);
            idb--;
        }
    }

//cout<<sumA<<" "<<sumB<<endl;

    if(sumA>sumB)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


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

using namespace std;
typedef long long ll;
vector<int> A,B;

int main(){
    int n,m,k;
    scanf("%d %d %d\n",&n,&m,&k);

    for(int i=0,temp;i<n;++i){
        scanf("%d",&temp);
        A.push_back(temp);
    }
    for(int i=0,temp;i<m;++i){
        scanf("%d",&temp);
        B.push_back(temp);
    }
    if(n>m){
        printf("YES\n");
        return 0;
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    int ida=n-1, idb=m-1;
    bool in=0;

/*for(int i=0;i<A.size();++i)   cout<<A[i]<<" ";
cout<<endl;
for(int i=0;i<B.size();++i) cout<<B[i]<<" ";
cout<<endl;
*/
    while( ida>=0 && idb>=0 ){

//printf("--ida:%d(%d)....idb:%d(%d)\n",ida,A[ida],idb,B[idb]);
        if(A[ida]>B[idb]){
            in=1;
            break;
        }
        --ida;
        --idb;
    }

//cout<<sumA<<" "<<sumB<<endl;

    if(in)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


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

using namespace std;
vector<int> A,B;

int main(){
    int n,m,k, sumA=0, sumB=0;
    scanf("%d %d %d\n",&n,&m,&k);
    A.push_back(0);

    for(int i=0,temp;i<n;++i){
        scanf("%d",&temp);
        sumA+=temp;
        A.push_back(temp);
    }
    for(int i=0,temp;i<m;++i){
        scanf("%d",&temp);
        sumB+=temp;
        B.push_back(temp);
    }
    if(sumA>sumB){
        printf("YES\n");
        return 0;
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    int ida=n, idb=m-1;
    bool in=0;

    while( ida>=0 && idb>=0 ){

//printf("--ida:%d(%d)....idb:%d(%d)\n",ida,A[ida],idb,B[idb]);
        in=0;
        if(A[ida]==B[idb]){
            while(ida>=0 && A[--ida]==B[idb]);
            --idb;
            continue;
        }
        if(A[ida]>B[idb]){
            --ida;
            continue;
        }
        while(idb>=0 && A[ida]<=B[idb]){
            sumB-=(B[idb]-A[ida]);
            idb--;
        }
    }

//cout<<sumA<<" "<<sumB<<endl;

    if(sumA>sumB)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


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

using namespace std;
typedef long long ll;
vector<int> A,B;

int main(){
    int n,m,k;
    long long sumA=0LL, sumB=0LL;
    scanf("%d %d %d\n",&n,&m,&k);
    A.push_back(0);

    for(int i=0,temp;i<n;++i){
        scanf("%d",&temp);
        sumA+=(ll)temp;
        A.push_back(temp);
    }
    for(int i=0,temp;i<m;++i){
        scanf("%d",&temp);
        sumB+=(ll)temp;
        B.push_back(temp);
    }
    if(sumA>sumB){
        printf("YES\n");
        return 0;
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    int ida=n, idb=m-1;

    if(A.back()>B.back()){
        printf("YES\n");
        return 0;
    }

for(int i=0;i<A.size();++i) cout<<A[i]<<" ";
cout<<endl;
for(int i=0;i<B.size();++i) cout<<B[i]<<" ";
cout<<endl;

    while( ida>=0 && idb>=0 ){

printf("--ida:%d(%d)....idb:%d(%d)\n",ida,A[ida],idb,B[idb]);
        if(A[ida]==B[idb]){
            while(idb>=0 && A[ida]==B[--idb]);
            --ida;
            continue;
        }
        if(A[ida]>B[idb]){
            --ida;
            continue;
        }
        while(idb>=0 && A[ida]<=B[idb]){
            sumB-=(B[idb]-A[ida]);
            idb--;
        }
    }

cout<<sumA<<" "<<sumB<<endl;

    if(sumA>sumB)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


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

using namespace std;
typedef long long ll;
vector<int> A,B;

int main(){
    int n,m,k;
    long long sumA=0LL, sumB=0LL;
    scanf("%d %d %d\n",&n,&m,&k);
    A.push_back(0);

    for(int i=0,temp;i<n;++i){
        scanf("%d",&temp);
        sumA+=(ll)temp;
        A.push_back(temp);
    }
    for(int i=0,temp;i<m;++i){
        scanf("%d",&temp);
        sumB+=(ll)temp;
        B.push_back(temp);
    }
    if(sumA>sumB){
        printf("YES\n");
        return 0;
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    int ida=n, idb=m-1;

    if(A.back()>B.back()){
        printf("YES\n");
        return 0;
    }

/*
for(int i=0;i<A.size();++i) cout<<A[i]<<" ";
cout<<endl;
for(int i=0;i<B.size();++i) cout<<B[i]<<" ";
cout<<endl;
*/
    while( ida>=0 && idb>=0 ){

//printf("--ida:%d(%d)....idb:%d(%d)\n",ida,A[ida],idb,B[idb]);
        if(A[ida]==B[idb]){
            while(idb>=0 && A[ida]==B[--idb]);
            --ida;
            continue;
        }
        if(A[ida]>B[idb]){
            --ida;
            continue;
        }
        while(idb>=0 && A[ida]<=B[idb]){
            sumB-=(B[idb]-A[ida]);
            idb--;
        }
    }

//cout<<sumA<<" "<<sumB<<endl;

    if(sumA>sumB)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


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

using namespace std;
typedef long long ll;
vector<int> A,B;

int main(){
    int n,m,k;
    long long sumA=0LL, sumB=0LL;
    scanf("%d %d %d\n",&n,&m,&k);
    A.push_back(0);

    for(int i=0,temp;i<n;++i){
        scanf("%d",&temp);
        sumA+=(ll)temp;
        A.push_back(temp);
    }
    for(int i=0,temp;i<m;++i){
        scanf("%d",&temp);
        sumB+=(ll)temp;
        B.push_back(temp);
    }
    if(sumA>sumB){
        printf("YES\n");
        return 0;
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    int ida=n, idb=m-1;

    if(A.back()>B.back()){
        printf("YES\n");
        return 0;
    }

/*
for(int i=0;i<A.size();++i) cout<<A[i]<<" ";
cout<<endl;
for(int i=0;i<B.size();++i) cout<<B[i]<<" ";
cout<<endl;
*/
    while( ida>=0 && idb>=0 ){

//printf("--ida:%d(%d)....idb:%d(%d)\n",ida,A[ida],idb,B[idb]);
        in=0;
        if(A[ida]==B[idb]){
            while(idb>=0 && A[ida]==B[--idb]);
            --ida;
            continue;
        }
        if(A[ida]>B[idb]){
            --ida;
            continue;
        }
        while(idb>=0 && A[ida]<=B[idb]){
            sumB-=(B[idb]-A[ida]);
            idb--;
        }
    }

//cout<<sumA<<" "<<sumB<<endl;

    if(sumA>sumB)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


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

using namespace std;
typedef long long ll;
vector<int> A,B;

int main(){
    int n,m,k;
    long long sumA=0LL, sumB=0LL;
    scanf("%d %d %d\n",&n,&m,&k);
    A.push_back(0);

    for(int i=0,temp;i<n;++i){
        scanf("%d",&temp);
        sumA+=(ll)temp;
        A.push_back(temp);
    }
    for(int i=0,temp;i<m;++i){
        scanf("%d",&temp);
        sumB+=(ll)temp;
        B.push_back(temp);
    }
    if(sumA>sumB){
        printf("YES\n");
        return 0;
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    int ida=n, idb=m-1;
/*
    if(A.back()>B.back()){
        printf("YES\n");
        return 0;
    }
*/
/*
for(int i=0;i<A.size();++i) cout<<A[i]<<" ";
cout<<endl;
for(int i=0;i<B.size();++i) cout<<B[i]<<" ";
cout<<endl;
*/
    while( ida>=0 && idb>=0 ){

//printf("--ida:%d(%d)....idb:%d(%d)\n",ida,A[ida],idb,B[idb]);
        if(A[ida]==B[idb]){
            while(idb>=0 && A[ida]==B[--idb]);
            --ida;
            continue;
        }
        if(A[ida]>B[idb]){
            printf("YES\n");
            return 0;
        }
        while(idb>=0 && A[ida]<=B[idb]){
            sumB-=(B[idb]-A[ida]);
            idb--;
        }
    }

//cout<<sumA<<" "<<sumB<<endl;

    if(sumA>sumB)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


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

using namespace std;
vector<int> A,B;

int main(){
    int n,m,k, sumA=0, sumB=0;
    scanf("%d %d %d\n",&n,&m,&k);
    A.push_back(0);

    for(int i=0,temp;i<n;++i){
        scanf("%d",&temp);
        sumA+=temp;
        A.push_back(temp);
    }
    for(int i=0,temp;i<m;++i){
        scanf("%d",&temp);
        sumB+=temp;
        B.push_back(temp);
    }
    if(sumA>sumB){
        printf("YES\n");
        return 0;
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    int ida=n, idb=m-1;
    bool in=0;
/*
for(int i=0;i<A.size();++i) cout<<A[i]<<" ";
cout<<endl;
for(int i=0;i<B.size();++i) cout<<B[i]<<" ";
cout<<endl;
*/
    while( ida>=0 && idb>=0 ){

//printf("--ida:%d(%d)....idb:%d(%d)\n",ida,A[ida],idb,B[idb]);
        in=0;
        if(A[ida]==B[idb]){
            while(idb>=0 && A[ida]==B[--idb]);
            --ida;
            continue;
        }
        if(A[ida]>B[idb]){
            --ida;
            continue;
        }
        while(idb>=0 && A[ida]<=B[idb]){
            sumB-=(B[idb]-A[ida]);
            idb--;
        }
    }

//cout<<sumA<<" "<<sumB<<endl;

    if(sumA>sumB)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#define N 1000
int comp(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}
int main()
{
    int a,b,n,va[N],vb[N],maxa=0,maxb=0,i;
    scanf("%d%d%d",&a,&b,&n);
    for ( i = 0; i <a; i++)
    {
        scanf("%d",&va[i]);
        if (va[i]>maxa)
        {
            maxa=va[i];
        }
    }
    for ( i = 0; i< b; i++)
    {
        scanf("%d",&vb[i]);
        if (maxb<vb[i])
        {
            maxb=vb[i];
        }
    }
    if(maxa>maxb)printf("YES\n%d%d",maxa,maxb);
    else
    {
        if (a>b)
        {
            printf("YES\n");
            return 0;
        }
        qsort(va,a,sizeof(int),comp);
        qsort(vb,b,sizeof(int),comp);
        if (a==b)
        {
            printf(va[0]>vb[0]?"YES\n":"NO\n");
        }
        if (a<b)
        {
            printf(va[0]>vb[b-a+2]?"YES\n":"NO\n");
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#define N 100
using namespace std;
bool cmp(int a,int b)
{
    return a<b;
}
int main(int argc, const char * argv[])
{
    int n,m,k,A[N],B[N],i,big=0,low=0;
    cin>>n>>m>>k;
    for (i=0; i<n; i++) {
        cin>>A[i];
    }
    for (i=0; i<m; i++) {
        cin>>B[i];
    }
    sort(A, A+n, cmp);
    sort(B,B+m,cmp);
    for (i=0; i<n; i++) {
        if (A[i]>B[i]) {
            big++;
        }
        if (A[i]<B[i]) {
            low++;
        }
    }
    if (n<m) {
        low+=m-n;
    }
    if (big>low) {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
}


#include<stdio.h>
#include<stdlib.h>
#define N 2*10000
int comp(const void *a,const void *b)
{
return *(long *)a-*(long *)b;
}
int main()
{
    long a,b,n,va[N],vb[N],maxa=0,maxb=0,i;
    scanf("%d%d%d",&a,&b,&n);
    for ( i = 0; i <a; i++)
    {
        scanf("%d",&va[i]);
        if (va[i]>maxa)
        {
            maxa=va[i];
        }
    }
    for ( i = 0; i< b; i++)
    {
        scanf("%d",&vb[i]);
        if (maxb<vb[i])
        {
            maxb=vb[i];
        }
    }
    if(maxa>maxb)printf("YES\n");
    else
    {
        if (a>b)
        {
            printf("YES\n");
            return 0;
        }
        qsort(va,a,sizeof(long),comp);
        qsort(vb,b,sizeof(long),comp);
        if (a==b)
        {
            printf(va[0]>vb[0]?"YES\n":"NO\n");
        }
        if (a<b)
        {
            printf(va[0]>vb[b-a+2]?"YES\n":"NO\n");
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#define N 100000
using namespace std;

bool cmp(int a,int b)
{return a<b;
}
int main(int argc, const char * argv[])
{

    int  a,b,i;
    double c,va[N],vb[N],maxa=0,maxb=0;
    cin>>a>>b>>c;
    for (i=0; i<a; i++) {
        cin>>va[i];
        if (maxa<va[i]) {
            maxa=va[i];
        }
    }
    for (i=0; i<b; i++) {
        cin>>vb[i];
        if (maxb<vb[i]) {
            maxb=vb[i];
        }
    }
    if (maxa>maxb||a>b) {
        cout<<"YES"<<endl;
    }else{
        sort(va, va+a,cmp);
        sort(vb, vb+b, cmp);
        if (a==b) {
            cout<<(va[0]>vb[0]?"YES":"NO")<<endl;
        }
        if (a<b) {
            cout<<(va[0]>vb[b-a+2]?"YES":"NO")<<endl;
        }
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#define N 1000
int comp(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}
int main()
{
	int a,b,va[N],vb[N],maxa=0,maxb=0;
	scanf("%d%d",&a,&b);
	for (int i = 0; i <a; i++)
	{
		scanf("%d",&va[i]);
		if (va[i]>maxa)
		{
			maxa=va[i];
		}
	}
	for (int i = 0; i < b; i++)
	{
		scanf("%d",&vb[i]);
		if (maxb<vb[i])
		{
			maxb=vb[i];
		}
	}
	if(maxa>maxb)printf("YES\n");
	else
	{
		if (a>b)
		{
			printf("YES\n");
			return 0;
		}
		qsort(va,a,sizeof(int),comp);
		qsort(vb,b,sizeof(int),comp);
		if (a==b)
		{
			printf(va[0]>vb[0]?"YES\n":"NO\n");
		}
		if (a<b)
		{
			printf(va[0]>vb[b-a+2]?"YES\n":"NO\n");
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#define N 100005
using namespace std;

int main(int argc, const char * argv[])
{

    int  a,b,i;
    int c,va[N],vb[N];
    cin>>a>>b>>c;
    for (i=0; i<a; i++) {
        cin>>va[i];
    }
    for (i=0; i<b; i++) {
        cin>>vb[i];
    }
        sort(va, va+a);
    sort(vb, vb+b);
    while (a&&b&&vb[b-1]>=va[a-1])a--,b--;
    if (a) {
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#define N 100
using namespace std;
bool cmp(int a,int b)
{
    return a<b;
}
int main(int argc, const char * argv[])
{
    int n,m,k,A[N],B[N],i,big=0,low=0;
    cin>>n>>m>>k;
    for (i=0; i<n; i++) {
        cin>>A[i];
    }
    for (i=0; i<m; i++) {
        cin>>B[i];
    }
    sort(A, A+n, cmp);
    sort(B,B+m,cmp);
    for (i=0; i<n; i++) {
        if (A[i]>B[i]) {
            big++;
        }
        if (A[i]<B[i]) {
            low++;
        }
    }
    if (n<m) {
        low+=m-n;
    }
    if (big>low) {
        cout<<"YES"<<endl;
    }
    else
        cout<<"NO"<<endl;
}


#include<stdio.h>
#include<stdlib.h>
#define N 1000
int comp(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}
int main()
{
	int a,b,n,va[N],vb[N],maxa=0,maxb=0,i;
	scanf("%d%d%d",&a,&b,&n);
	for ( i = 0; i <a; i++)
	{
		scanf("%d",&va[i]);
		if (va[i]>maxa)
		{
			maxa=va[i];
		}
	}
	for ( i = 0; i< b; i++)
	{
		scanf("%d",&vb[i]);
		if (maxb<vb[i])
		{
			maxb=vb[i];
		}
	}
	if(maxa>maxb)printf("YES\n");
	else
	{
		if (a>b)
		{
			printf("YES\n");
			return 0;
		}
		qsort(va,a,sizeof(int),comp);
		qsort(vb,b,sizeof(int),comp);
		if (a==b)
		{
			printf(va[0]>vb[0]?"YES\n":"NO\n");
		}
		if (a<b)
		{
			printf(va[0]>vb[b-a+2]?"YES\n":"NO\n");
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#define N 100000
using namespace std;

bool cmp(double a,double b)
{return a<b;
}
int main(int argc, const char * argv[])
{

    int  a,b,i;
    double c,va[N],vb[N],maxa=0,maxb=0;
    cin>>a>>b>>c;
    for (i=0; i<a; i++) {
        cin>>va[i];
        if (maxa<va[i]) {
            maxa=va[i];
        }
    }
    for (i=0; i<b; i++) {
        cin>>vb[i];
        if (maxb<vb[i]) {
            maxb=vb[i];
        }
    }
    if (maxa>maxb||a>b) {
        cout<<"YES"<<endl;
    }else{
        sort(va, va+a,cmp);
        sort(vb, vb+b, cmp);
        if (a==b) {
            cout<<(va[0]>vb[0]?"YES":"NO")<<endl;
        }
        if (a<b) {
            cout<<(va[0]>vb[b-a+2]?"YES":"NO")<<endl;
        }
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<string.h>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define oo 1000000001
#define MAXN 400005
using namespace std;
int n,m,k,a[100005],b[100005];
bool judge()
{
       while (m && n && b[m]>=a[n]) m--,n--;
       if (n && (!m || a[n]>b[m])) return true;
       return false;
}
int main()
{
       int i,j;
       while (~scanf("%d%d%d",&n,&m,&k))
       {
             for (i=1;i<=n;i++) scanf("%d",&a[i]);
             sort(a+1,a+1+n);
             for (i=1;i<=m;i++) scanf("%d",&b[i]);
             sort(b+1,b+1+m);
             if (judge()) printf("YES\n");
                   else   printf("NO\n");
       }
       return 0;
}


#include <iostream>
#include <algorithm>
#define N 100000
using namespace std;

int main(int argc, const char * argv[])
{

    int  a,b,i;
    double c,va[N],vb[N];
    cin>>a>>b>>c;
    for (i=0; i<a; i++) {
        cin>>va[i];
    }
    for (i=0; i<b; i++) {
        cin>>vb[i];
    }
        sort(va, va+a);
    sort(vb, vb+b);
    while (a&&b&&vb[b-1]>=va[a-1])a--,b--;
    if (a) {
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
    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 << "NO";
        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();
    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(n > m)
        cout << "YES";
    else if(n < m){
        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{
        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();
    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 =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;

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;
    int gobble = 0;
    bloc = 0;
    long long temp;
    for(it_m = diff.begin();it_m != diff.end(); it_m++){
        if(it_m->second < 0 ){
            temp = -(it_m->second);
            if(gobble >0)
                gobble += (it_m->second);
            if(gobble <0)
                gobble = 0;
            for(int xx =0;xx<temp;xx++)
                boF[bloc++] = it_m->first;
        }
        if(it_m->second > 0 ){
            temp = (it_m->second);
            gobble += (it_m->second);
            for(int xx =0;xx<temp;xx++)
                alF[aloc++] = it_m->first;
        }
    }

    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 != 0)
            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;
}