#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j>0;i--)
        {
            if(s[i]==v[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    long int n,m,v=0;
    cin>>n>>m;
    string a[n],b[m];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<m;i++)
        cin>>b[i];
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(a[i]==b[j])
                v++;
        }
    }
    if(v%2==1)
        cout<<"YES";
    else
        cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j>0;i--)
        {
            if(s[i]==v[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j>0;j--)
        {
            if(s[i]==v[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if(s[0]==v[0])
    {
        cout<<"YES";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j>0;i--)
        {
            if(s[i]==v[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

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


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    int o=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(s[i]!=v[j])
            {
                o++;
            }
            if(o==m)
                o=i+1;
        }
    }
    if((o==n)&&(m==n))
    {
        cout<<"NO";
        return 0;
    }
    if(s[0]==v[0])
    {
        cout<<"YES";
        return 0;
    }
    for(int i=1;i<m;i++)
    {
        for(int j=i;j>=0;j--)
        {
            if(v[i]==s[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i;j>=0;j--)
        {
            if(s[i]==v[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n+m];
    for(int i=0;i<n+m;i++)
    {
        cin>>s[i];
    }
    if((n>m)||n==m)
        cout<<"YES";
    else
        cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i;j>=0;j--)
        {
            if(s[i]==v[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<m;i++)
    {
        for(int j=i-1;j>0;j--)
        {
            if(s[i]==v[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i;j>0;j--)
        {
            if(v[i]==s[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    int o=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(s[i]!=v[j])
            {
                o++;
            }
        }
    }
    if((o==n)&&(m==n))
    {
        cout<<"NO";
        return 0;
    }

    for(int i=0;i<m;i++)
    {
        for(int j=i;j>=0;j--)
        {
            if(v[i]==s[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    long int n,m;
    cin>>n>>m;
    string a[n],b[m];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<m;i++)
        cin>>b[i];
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(a[i]==b[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((s[0]==v[0])||(s[0]!=v[0]))
    {
        cout<<"YES";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j>0;i--)
        {
            if(s[i]==v[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }//6
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(s[i]==v[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(v[i]==s[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<m;j++)
        {
            if(s[i]==v[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(v[i]==s[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j>0;i--)
        {
            if(v[i]==s[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i;j>=0;j--)
        {
            if(s[i-1]==v[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<m;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(v[i]==s[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<m;i++)
    {
        for(int j=i;j>=0;j--)
        {
            if(v[i]==s[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<m;i++)
    {
        for(int j=i;j<n;j++)
        {
            if(v[i]==s[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<m;i++)
    {
        for(int j=i;j>=0;j--)
        {
            if(v[i]==s[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<m;i++)
    {
        for(int j=i-1;j>0;i--)
        {
            if(v[i]==s[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<m;i++)
    {
        for(int j=i-1;j>0;j--)
        {
            if(v[i]==s[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        if(v[i]==s[i])
        {
            cout<<"YES";
            return 0;
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    int o=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(s[i]==v[j])
            {
                o++;
            }
        }
    }
    if((o==n)&&(m==n))
    {
        cout<<"NO";
        return 0;
    }

    for(int i=0;i<m;i++)
    {
        for(int j=i;j>=0;j--)
        {
            if(v[i]==s[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j>0;j--)
        {
            if(s[i]==v[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<m;j++)
        {
            if(s[i]==v[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<m;i++)
    {
        for(int j=i-1;j>0;j--)
        {
            if(s[i]==v[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(s[i]==v[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j>0;i--)
        {
            if(s[i]==v[j])
            {
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    int r=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<m;j++)
        {
            if(v[i]==s[j])
            {
                cout<<"NO";
                return 0;
            }
        }
        if(i==n-1)
        {
            cout<<"YES";
            return 0;
        }
    }
    cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"NO";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j>0;i--)
        {
            if(v[i]==s[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    string s[n],v[m];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>v[i];
    }
    if(n>m)
    {
        cout<<"YES";
        return 0;
    }
    else if(n<m)
    {
        cout<<"NO";
        return 0;
    }
    if((n==1)&&(m==1))
    {
        cout<<"YES";
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i-1;j>0;i--)
        {
            if(s[i]==v[j])
            {
                cout<<"NO";
                return 0;
            }
        }
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
int m,n,s1=0,s2=0,ans=0;
string s;
map<string,int>v;
cin>>n>>m;

for(int i=1;i<=n;i++)
{
  cin>>s;
   //if(v.find(s)==v.end())s1++;
  s1++;
  v[s]=i*10;
}

for(int i=1;i<=m;i++)
{
  cin>>s;
  if(v.find(s)==v.end())s2++;
  else ans++;
  v[s]=i*101;
}
s2+=ans/2;
s1-=ans/2;
if(s1>s2)cout<<"YES"<<endl;
else
    cout<<"NO"<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
int m,n,s1=0,s2=0;
string s;
map<string,int>v;
cin>>n>>m;

for(int i=1;i<=n;i++)
{
  cin>>s;
  v[s]=1;
  s1++;
}

for(int i=1;i<=m;i++)
{
  cin>>s;
  if(v.find(s)==v.end())s2++;
}

if(s1>s2)cout<<"YES"<<endl;
else
    cout<<"NO"<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
int m,n,s1=0,s2=0;
string s;
map<string,int>v;
cin>>n>>m;

for(int i=1;i<=n;i++)
{
  cin>>s;
   if(v.find(s)==v.end())s1++;
  v[s]=i*10;
}

for(int i=1;i<=m;i++)
{
  cin>>s;
  if(v.find(s)==v.end())s2++;
  v[s]=i*101;
}

if(s1>s2)cout<<"YES"<<endl;
else
    cout<<"NO"<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
int m,n,s1=0,s2=0;
string s;
map<string,int>v;
cin>>n>>m;

for(int i=1;i<=n;i++)
{
  cin>>s;
   if(v.find(s)==v.end())s1++;
  v[s]=1;
}

for(int i=1;i<=m;i++)
{
  cin>>s;
  if(v.find(s)==v.end())s2++;
}

if(s1>s2)cout<<"YES"<<endl;
else
    cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int n,m;
map<string, int>m1,m2,m3;
string s;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        m1[s]++;
    }
    for(int i=0;i<m;i++)
    {
        cin>>s;
        if(m1[s]!=0)
        m2[s]++;
    }
    int sz=m2.size();
    int a=n-sz;
    int b=m-sz;
    a+=sz/2;
    b+=sz/2;
    if(sz%2==1)
    a++;
    if(a>b)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    else
    {
        cout<<"NO"<<endl;
        return 0;
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int n,m;
map<string, int>m1,m2,m3;
string s;
int main()
{
    //ios_base::sync_with_stdio(0);
    //cin.tie(NULL);
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        m1[s]++;
    }
    for(int i=0;i<m;i++)
    {
        cin>>s;
        if(m1[s]!=0)
        m2[s]++;
    }
    int sz=m2.size();
    int a=n-sz;
    int b=m-sz;
    a+=sz/2;
    b+=sz/2;
    if(sz%2==1)
    a++;
    if(a>b)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    else
    {
        cout<<"NO"<<endl;
        return 0;
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int n,m;
map<string, int>m1,m2,m3;
string s;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        m1[s]++;
    }
    for(int i=0;i<m;i++)
    {
        cin>>s;
        if(m1[s]!=0)
        m2[s]++;
    }
    int sz=m2.size();
    int a=n-sz;
    int b=m-sz;
    a+=sz/2;
    b+=sz/2;
    if(sz%2==1)
    a++;
    if(a>b)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    else
    {
        cout<<"NO"<<endl;
        return 0;
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int n,m;
map<string, int>m1,m2,m3;
string s;
int main()
{
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        m1[s]++;
    }
    for(int i=0;i<m;i++)
    {
        cin>>s;
        if(m1[s]!=0)
        m2[s]++;
    }
    int sz=m2.size();
    int a=n-sz;
    int b=m-sz;
    a+=sz/2;
    b+=sz/2;
    if(sz%2==1)
    a++;

 //   cout<<"a="<<a<<"b="<<b<<endl;

    if(a>b)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    else
    {
        cout<<"NO"<<endl;
        return 0;
    }

}


#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;

int n,m;
map<string, int>m1,m2,m3;
string s;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        m1[s]++;
    }
    for(int i=0;i<m;i++)
    {
        cin>>s;
        if(m1[s]!=0)
        m2[s]++;
    }
    int sz=m2.size();
    int a=n-sz;
    int b=m-sz;
    a+=sz/2;
    b+=sz/2;
    if(sz%2==1)
    a++;
    if(a>b)
    {
        cout<<"YES"<<endl;
        return 0;
    }
    else
    {
        cout<<"NO"<<endl;
        return 0;
    }
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int common = m - distinctEnem;
    int distincPol = n - common;
    if(common % 2 == 0)
        if(n <= m)
            cout << "NO"; return 0;

    cout << "YES";
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int common = m - distinctEnem;
    int distincPol = n - common;
    if(distincPol >= (distinctEnem && common % 2 == 0))
        cout << "YES";
    else
        cout << "NO";
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int common = m - distinctEnem;
    int distincPol = n - common;
    if(distincPol >= distinctEnem && common % 2 == 0)
        cout << "YES";
    else
        cout << "NO";
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int distincPol = n - m + distinctEnem;
    if(distinctEnem > distincPol){
        cout << "NO";
        return 0;
    }
    if(distincPol > distinctEnem){
        cout << "YES";
        return 0;
    }
    if(distincPol == 0)
        cout << "NO";
    else
        cout << "YES";
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int common = m - distinctEnem;
    int distincPol = n - common;
    if(distincPol >= distinctEnem || common % 2 == 0)
        cout << "YES";
    else
        cout << "NO";
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int distincPol = n - m + distinctEnem;
    if(distinctEnem > distincPol){
        cout << "NO";
        return 0;
    }
    if(distincPol > distinctEnem){
        cout << "YES";
        return 0;
    }
    cout << "YES";
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int common = m - distinctEnem;
    int distincPol = n - common;
    if(common % 2 == 0)
        if(n >= m){
            cout << "YES"; return 0;}

    cout << "NO";
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int distincPol = n - m + distinctEnem;
    if(distinctEnem > distincPol){
        cout << "NO";
        return 0;
    }
    if(distincPol > distinctEnem){
        cout << "YES";
        return 0;
    }
    cout << "NO";
    return 0;
}


#include <iostream>
using namespace std;
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int distincPol = n - m + distinctEnem;
    if(distinctEnem > distincPol){
        cout << "NO";
        return 0;
    }
    if(distincPol > distinctEnem){
        cout << "YES";
        return 0;
    }
    if(distincPol == 0)
        cout << "NO";
    else
        cout << "YES";
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int common = m - distinctEnem;
    int distincPol = n - common;
    if(common % 2 == 0)
        if(n <= m)
            {cout << "NO"; return 0;}

    cout << "YES";
    return 0;
}


//#include <cmath>
//#include <cstdio>
//#include <vector>
//#include <set>
//#include <queue>
//#include <map>
//#include <iostream>
//#include <algorithm>
//#include <fstream>
//using namespace std;
//struct die{
//    int x, y, z;
//};
//int cal(string t){
//    int val = 0;
//    for(int i = 0; i < t.size(); i++){
//        val *= 10;
//        val += (int)(t[i] - '0');
//    }
//    return val;
//}
//struct die parse(string t){
//    int i = 0;
//    struct die res;
//    string x = "";
//    string y = "";
//    string z = "";
//    while(t[i] != 'd'){
//        x += t[i];
//        i++;
//    }
//    res.x = cal(x);
//    i++;
//    while(i < t.size() && t[i] >= '0' && t[i] <= '9'){
//        y += t[i];
//        i++;
//    }
//    res.y = cal(y);
//    res.z = 0;
//    if(i < t.size()){
//        char symbol = t[i];
//        i++;
//        while(i < t.size()){
//            z += t[i];
//            i++;
//        }
//        int temp = cal(z);
//        if(symbol == '-'){
//            temp *= -1;
//        }
//        res.z = temp;
//    }
//    return res;
//}
//double calcProb(struct die in, int k){
//    int l, r;
//    l = in.x + in.z;
//    r = in.x * in.y + in.z;
//    if(k <= l)
//        return 1;
//    if(k > r)
//        return 0;
//}
#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    string pol[n], enem[m];
    for(int i = 0; i < n; i++)
        cin >> pol[i];
    sort(pol, pol + n);
    int common = 0;
    for(int i = 0; i < m; i++){
        cin >> enem[i];
        if(binary_search(pol, pol + n, enem[i]))
            common++;
    }
    int distPol = n - common;
    int distEnem = m - common;
    if(common % 2 == 0){
        if(distPol > distEnem)
            cout << "YES";
        else
            cout << "NO";
    }
    else{
        if(distPol >= distEnem)
            cout << "YES";
        else
            cout << "NO";
    }
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
bool binarySearch(string s, string arr[], int low, int high){
    if(low == high)
        return arr[low] == s;
    int mid = (low + high) / 2;
    if(s > arr[mid])
        return binarySearch(s, arr, mid + 1, high);
    return binarySearch(s, arr, low, mid);
}
int main()
{
    int n, m;
    cin >> n >> m;
    if(n > m){
        cout << "YES";
        return 0;
    }
    string pol[n], enem[m];
    for(int i = 0; i < n; i++){
        cin >> pol[i];
    }
    for(int i = 0; i < m; i++){
        cin >> enem[i];
    }
    sort(pol, pol + n);
    int distinctEnem = 0;
    for(int i = 0; i < m; i++){
        if(binarySearch(enem[i], pol, 0, n - 1))
            continue;
        distinctEnem++;
    }
    int distincPol = n - m + distinctEnem;
    if(distinctEnem > distincPol){
        cout << "NO";
        return 0;
    }
    if(distincPol > distinctEnem){
        cout << "YES";
        return 0;
    }
    cout << "YES";
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define pllilli pair<long long , long long>
#define mp make_pair
#define pb push_back

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
    int m,n;
    cin>>n>>m;
    map<string,int> pol,ene,common;
    string temp;
    for (int i=0; i<n; i++)
    {
        cin>>temp;
        pol[temp]++;
        common[temp]++;
    }

    for (int i=0; i<m; i++)
    {
        cin>>temp;
        ene[temp]++;
        common[temp]++;
    }
    map<string,int>::iterator it;
    int cnt = 0;
    for (it = common.begin(); it!=common.end(); it++)
    {
        if (it->second == 2)
        {
            temp = it->first;
            pol.erase(temp);
            ene.erase(temp);
            cnt++;
        }
    }
    if (cnt%2==0)
    {
        if (pol.size() > ene.size())
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    else
    {
        if (pol.size() < ene.size())
            cout<<"NO\n";
        else
            cout<<"YES\n";
    }
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define pllilli pair<long long , long long>
#define mp make_pair
#define pb push_back

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
    int m,n;
    cin>>n>>m;
    map<string,int> pol,ene;
    string temp;
    for (int i=0; i<n; i++)
    {
        cin>>temp;
        pol[temp]++;
    }

    for (int i=0; i<m; i++)
    {
        cin>>temp;
        ene[temp]++;
    }
    map<string,int>::iterator it;
    while (1)
    {
        it = pol.begin();
        temp = it->first;

        ene.erase(temp);
        pol.erase(temp);

        if (ene.empty())
        {
            cout<<"YES\n";
            break;
        }

        it = ene.begin();
        temp = it->first;

        pol.erase(temp);
        ene.erase(temp);

        if (pol.empty())
        {
            cout<<"NO\n";
            break;
        }
    }
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define pllilli pair<long long , long long>
#define mp make_pair
#define pb push_back

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
    int m,n;
    cin>>n>>m;
    map<string,int> pol,ene,common;
    string temp;
    for (int i=0; i<n; i++)
    {
        cin>>temp;
        pol[temp]++;
        common[temp]++;
    }

    for (int i=0; i<m; i++)
    {
        cin>>temp;
        ene[temp]++;
        common[temp]++;
    }
    map<string,int>::iterator it;
    int cnt = common.size();
    for (it = common.begin(); it!=common.end(); it++)
    {
        if (it->second ==2)
        {
            temp = it->first;
            pol.erase(temp);
            ene.erase(temp);
        }
    }
    if (cnt%2==0)
    {
        if (pol.size() > ene.size())
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    else
    {
        if (pol.size() > ene.size())
            cout<<"NO\n";
        else
            cout<<"YES\n";
    }
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define pllilli pair<long long , long long>
#define mp make_pair
#define pb push_back

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
    int m,n;
    cin>>n>>m;
    map<string,int> pol,ene,common;
    string temp;
    for (int i=0; i<n; i++)
    {
        cin>>temp;
        pol[temp]++;
        common[temp]++;
    }

    for (int i=0; i<m; i++)
    {
        cin>>temp;
        ene[temp]++;
        common[temp]++;
    }
    map<string,int>::iterator it;
    int cnt = 0;
    for (it = common.begin(); it!=common.end(); it++)
    {
        if (it->second == 2)
        {
            temp = it->first;
            pol.erase(temp);
            ene.erase(temp);
            cnt++;
        }
    }
    if (cnt%2==0)
    {
        if (pol.size() > ene.size())
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    else
    {
        if (pol.size() > ene.size())
            cout<<"NO\n";
        else
            cout<<"YES\n";
    }
	return 0;
}


#include <math.h>
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <stdio.h>
#include <cctype>
#include <bitset>
#define inf 10000000000005
#define MOD 1000000007
#define MAX 200005
using namespace std;
typedef long long ll;

int main(){
int n,m;
scanf("%d%d",&n,&m);
vector <string> v1,v2;
set <string> s1,s2;
string s;
for(int i=0; i<n; i++){cin>>s; v1.push_back(s);s1.insert(s);}
for(int i=0; i<m; i++){cin>>s; v2.push_back(s);s2.insert(s);}
if(s1.size()>s2.size()){printf("YES");return 0;}
if(s1.size()<s2.size()){printf("NO");return 0;}
if(s1.size()==s2.size()){
    set<string> s;int i,j;
for( i=0,j=0; i<n&&j<m; i++,j++){
if(!s.count(v1[i]))s.insert(v1[i]);
else{while(!s.count(v1[i])&&i<n)i++; if(s.count(v1[i])){printf("NO");return 0;}s.insert(v1[i]);}
if(!s.count(v2[i]))s.insert(v2[i]);
else{while(!s.count(v2[i])&&j<m)j++;if(s.count(v2[j])){printf("YES");return 0;} s.insert(v2[j]);}
    }
if(i<n)printf("YES");
else printf("NO");
}

return 0;
}


#include <math.h>
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <stdio.h>
#include <cctype>
#include <bitset>
#define inf 10000000000005
#define MOD 1000000007
#define MAX 200005
using namespace std;
typedef long long ll;

int main(){
int n,m;
scanf("%d%d",&n,&m);
vector <string> v1,v2;
set <string> s1,s2;
string s;
for(int i=0; i<n; i++){cin>>s; v1.push_back(s);s1.insert(s);}
for(int i=0; i<m; i++){cin>>s; v2.push_back(s);s2.insert(s);}
if(s1.size()>s2.size()){printf("YES");return 0;}
if(s1.size()<s2.size()){printf("NO");return 0;}
if(s1.size()==s2.size()){
    set<string> s;int i=0,j=0;
while(i<n&&j<m){
if(!s.count(v1[i])){s.insert(v1[i]);i++;}
else{while(!s.count(v1[i])&&i<n)i++; if(s.count(v1[i])){printf("NO");return 0;}s.insert(v1[i]);}
if(!s.count(v2[j])){s.insert(v2[j]);j++;}
else{while(!s.count(v2[j])&&j<m)j++; if(s.count(v2[j])){printf("YES");return 0;} s.insert(v2[j]);}
    }

}

return 0;
}


#include <math.h>
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <stdio.h>
#include <cctype>
#include <bitset>
#define inf 10000000000005
#define MOD 1000000007
#define MAX 200005
using namespace std;
typedef long long ll;

int main(){
int n,m;
scanf("%d%d",&n,&m);
vector <string> v1,v2;
set <string> s1,s2;
string s;
for(int i=0; i<n; i++){cin>>s; v1.push_back(s);s1.insert(s);}
for(int i=0; i<m; i++){cin>>s; v2.push_back(s);s2.insert(s);}
if(s1.size()>s2.size()){printf("YES");return 0;}
if(s1.size()<s2.size()){printf("NO");return 0;}
if(s1.size()==s2.size()){
    set<string> s;int i,j;
for( i=0,j=0; i<n&&j<m; i++,j++){
if(!s.count(v1[i]))s.insert(v1[i]);
else{while(!s.count(v1[i])&&i<n)i++; if(s.count(v1[i])){printf("NO");return 0;}s.insert(v1[i]);}
if(!s.count(v2[j]))s.insert(v2[j]);
else{while(!s.count(v2[j])&&j<m)j++; if(s.count(v2[j])){printf("YES");return 0;} s.insert(v2[j]);}
    }
if(i<n)printf("YES");
else printf("NO");
}

return 0;
}


#include <math.h>
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <stdio.h>
#include <cctype>
#include <bitset>
#define inf 10000000000005
#define MOD 1000000007
#define MAX 200005
using namespace std;
typedef long long ll;

int main(){
int n,m;
scanf("%d%d",&n,&m);
	string s;
map<string,int> bad,pol,en;
vector<string> v1,v2;
for(int i=0; i<n; i++){cin>>s; pol[s]=1; v1.push_back(s);}
int ans=0;
for(int i=0;i<m;i++){cin>>s; en[s]=1; if(pol.count(s)){ans++;} v2.push_back(s);}
int a[2]; a[0]=v1.size(),a[1]=v2.size();
a[0]-=ans; a[1]-=ans;
if(ans%2==1){a[0]++;}
if(a[0]>a[1]){printf("YES"); return 0;}
	printf("NO");
	return 0;
}


#include <math.h>
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <stdio.h>
#include <cctype>
#include <bitset>
#define inf 10000000000005
#define MOD 1000000007
#define MAX 200005
using namespace std;
typedef long long ll;

int main(){
int n,m;
scanf("%d%d",&n,&m);
vector <string> v1,v2;
set <string> s1,s2;
string s;
for(int i=0; i<n; i++){cin>>s; v1.push_back(s);s1.insert(s);}
for(int i=0; i<m; i++){cin>>s; v2.push_back(s);s2.insert(s);}
if(s1.size()>s2.size()){printf("YES");return 0;}
if(s1.size()<s2.size()){printf("NO");return 0;}
if(s1.size()==s2.size()){
    set<string> s;int i=0,j=0;
while(i<n&&j<m){
if(!s.count(v1[i])){s.insert(v1[i]);i++;}
else{while(!s.count(v1[i])&&i<n)i++; if(s.count(v1[i])){printf("NO");return 0;}s.insert(v1[i]);}
if(!s.count(v2[j])){s.insert(v2[j]);j++;}
else{while(!s.count(v2[j])&&j<m)j++; if(s.count(v2[j])){printf("YES");return 0;} s.insert(v2[j]);}
    }
if(i<=n)printf("YES");
else printf("NO");
}

return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<string>
#include<set>
#include<cmath>
#include<cctype>
#include<stack>
#include<cstdlib>
#include<utility>
#include<vector>
#include<deque>
#include<queue>
#include<algorithm>

#define sc scanf
#define si(t) scanf("%d",&t)
#define sl(t) scanf("%I64d",&t)
#define sii(a,b) scanf("%d%d",&a,&b)

#define P(a) printf("%d\n",a)
#define PLN(a) printf("%I64d ",a)
#define pf printf

#define gcd(a,b) __gcd(a,b)
#define ff first
#define ss second
#define pr1(a) cout<<a<<endl
#define pr2(a,b) cout<<a<<" "<<b<<endl
#define pb push_back
#define pii pair<int,int>
#define pi acos(-1.0)
#define PI 3.1415926535897932385
#define Sin(a) sin((pi*a)/180)
#define siz 1000001
#define mem(ar) memset(ar,0,sizeof ar)
#define one(x) __builtin_popcount(x)
typedef long long ll;
using namespace std;
//int dx[]= {-1,-1,0,0,1,1};
//int dy[]= {-1,0,-1,1,0,1};
//int dx[]= {0,0,1,-1};/*4 side move*/
//int dy[]= {-1,1,0,0};/*4 side move*/
//int dx[]= {1,1,0,-1,-1,-1,0,1};/*8 side move*/
//int dy[]= {0,1,1,1,0,-1,-1,-1};/*8 side move*/
//int dx[]={1,1,2,2,-1,-1,-2,-2};/*knight move*/
//int dy[]={2,-2,1,-1,2,-2,1,-1};/*knight move*/
map<ll,bool>visi;
map<string,int>vis;
int main()
{

    //freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
    int  i,j,n,m,a,c,b,d,ck,t,r,x,y,ans,rem,cnt,lo,hi,sum,cs=1;
    string st;
    si(n),si(m);
    for(i=0; i<n; i++)
    {
        cin>>st;
        vis[st]=1;
    }
    r=0;
    for(i=0; i<m; i++)
    {
        cin>>st;
        if(vis[st]==1) r++;
    }
    n=n-r;
    m=m-r;
    n+=r%2;
    if(n>m) printf("YES\n");
    else
        printf("NO\n");
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<string>
#include<set>
#include<cmath>
#include<cctype>
#include<stack>
#include<cstdlib>
#include<utility>
#include<vector>
#include<deque>
#include<queue>
#include<algorithm>

#define sc scanf
#define si(t) scanf("%d",&t)
#define sl(t) scanf("%I64d",&t)
#define sii(a,b) scanf("%d%d",&a,&b)

#define P(a) printf("%d\n",a)
#define PLN(a) printf("%I64d ",a)
#define pf printf

#define gcd(a,b) __gcd(a,b)
#define ff first
#define ss second
#define pr1(a) cout<<a<<endl
#define pr2(a,b) cout<<a<<" "<<b<<endl
#define pb push_back
#define pii pair<int,int>
#define pi acos(-1.0)
#define PI 3.1415926535897932385
#define Sin(a) sin((pi*a)/180)
#define siz 1000001
#define mem(ar) memset(ar,0,sizeof ar)
#define one(x) __builtin_popcount(x)
typedef long long ll;
using namespace std;
//int dx[]= {-1,-1,0,0,1,1};
//int dy[]= {-1,0,-1,1,0,1};
//int dx[]= {0,0,1,-1};/*4 side move*/
//int dy[]= {-1,1,0,0};/*4 side move*/
//int dx[]= {1,1,0,-1,-1,-1,0,1};/*8 side move*/
//int dy[]= {0,1,1,1,0,-1,-1,-1};/*8 side move*/
//int dx[]={1,1,2,2,-1,-1,-2,-2};/*knight move*/
//int dy[]={2,-2,1,-1,2,-2,1,-1};/*knight move*/
map<ll,bool>visi;
map<string,int>vis;
int main()
{

    //freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
    int  i,j,n,m,a,c,b,d,ck,t,r,x,y,ans,rem,cnt,lo,hi,sum,cs=1;
    string st;
    si(n),si(m);
    for(i=0; i<n; i++)
    {
        cin>>st;
        vis[st]=1;
    }
    r=0;
    for(i=0; i<m; i++)
    {
        cin>>st;
        if(vis[st]==0) r++;
    }
    n=n-r;
    m=m-r;
    if(n>=m) printf("YES\n");
    else printf("NO\n");
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<string>
#include<set>
#include<cmath>
#include<cctype>
#include<stack>
#include<cstdlib>
#include<utility>
#include<vector>
#include<deque>
#include<queue>
#include<algorithm>

#define sc scanf
#define si(t) scanf("%d",&t)
#define sl(t) scanf("%I64d",&t)
#define sii(a,b) scanf("%d%d",&a,&b)

#define P(a) printf("%d\n",a)
#define PLN(a) printf("%I64d ",a)
#define pf printf

#define gcd(a,b) __gcd(a,b)
#define ff first
#define ss second
#define pr1(a) cout<<a<<endl
#define pr2(a,b) cout<<a<<" "<<b<<endl
#define pb push_back
#define pii pair<int,int>
#define pi acos(-1.0)
#define PI 3.1415926535897932385
#define Sin(a) sin((pi*a)/180)
#define siz 1000001
#define mem(ar) memset(ar,0,sizeof ar)
#define one(x) __builtin_popcount(x)
typedef long long ll;
using namespace std;
//int dx[]= {-1,-1,0,0,1,1};
//int dy[]= {-1,0,-1,1,0,1};
//int dx[]= {0,0,1,-1};/*4 side move*/
//int dy[]= {-1,1,0,0};/*4 side move*/
//int dx[]= {1,1,0,-1,-1,-1,0,1};/*8 side move*/
//int dy[]= {0,1,1,1,0,-1,-1,-1};/*8 side move*/
//int dx[]={1,1,2,2,-1,-1,-2,-2};/*knight move*/
//int dy[]={2,-2,1,-1,2,-2,1,-1};/*knight move*/
map<ll,bool>visi;
map<string,int>vis;
int main()
{

    //freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
    int  i,j,n,m,a,c,b,d,ck,t,r,x,y,ans,rem,cnt,lo,hi,sum,cs=1;
    string st;
    si(n),si(m);
    for(i=0; i<n; i++)
    {
        cin>>st;
        vis[st]=1;
    }
    r=0;
    for(i=0; i<m; i++)
    {
        cin>>st;
        if(vis[st]==0) r++;
    }
    if(n>r) printf("YES\n");
    else printf("NO\n");
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<string>
#include<set>
#include<cmath>
#include<cctype>
#include<stack>
#include<cstdlib>
#include<utility>
#include<vector>
#include<deque>
#include<queue>
#include<algorithm>

#define sc scanf
#define si(t) scanf("%d",&t)
#define sl(t) scanf("%I64d",&t)
#define sii(a,b) scanf("%d%d",&a,&b)

#define P(a) printf("%d\n",a)
#define PLN(a) printf("%I64d ",a)
#define pf printf

#define gcd(a,b) __gcd(a,b)
#define ff first
#define ss second
#define pr1(a) cout<<a<<endl
#define pr2(a,b) cout<<a<<" "<<b<<endl
#define pb push_back
#define pii pair<int,int>
#define pi acos(-1.0)
#define PI 3.1415926535897932385
#define Sin(a) sin((pi*a)/180)
#define siz 1000001
#define mem(ar) memset(ar,0,sizeof ar)
#define one(x) __builtin_popcount(x)
typedef long long ll;
using namespace std;
//int dx[]= {-1,-1,0,0,1,1};
//int dy[]= {-1,0,-1,1,0,1};
//int dx[]= {0,0,1,-1};/*4 side move*/
//int dy[]= {-1,1,0,0};/*4 side move*/
//int dx[]= {1,1,0,-1,-1,-1,0,1};/*8 side move*/
//int dy[]= {0,1,1,1,0,-1,-1,-1};/*8 side move*/
//int dx[]={1,1,2,2,-1,-1,-2,-2};/*knight move*/
//int dy[]={2,-2,1,-1,2,-2,1,-1};/*knight move*/
map<ll,bool>visi;
map<string,int>vis;
int main()
{

    //freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
    int  i,j,n,m,a,c,b,d,ck,t,r,x,y,ans,rem,cnt,lo,hi,sum,cs=1;
    string st;
    si(n),si(m);
    for(i=0; i<n; i++)
    {
        cin>>st;
        vis[st]=1;
    }
    r=0;
    for(i=0; i<m; i++)
    {
        cin>>st;
        if(vis[st]==0) r++;
    }
    if(n>m) printf("YES\n");
    else if(n<m)  printf("NO\n");
    else
    {
        if(n>r) printf("YES\n");
        else
            printf("NO\n");
    }
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<string>
#include<set>
#include<cmath>
#include<cctype>
#include<stack>
#include<cstdlib>
#include<utility>
#include<vector>
#include<deque>
#include<queue>
#include<algorithm>

#define sc scanf
#define si(t) scanf("%d",&t)
#define sl(t) scanf("%I64d",&t)
#define sii(a,b) scanf("%d%d",&a,&b)

#define P(a) printf("%d\n",a)
#define PLN(a) printf("%I64d ",a)
#define pf printf

#define gcd(a,b) __gcd(a,b)
#define ff first
#define ss second
#define pr1(a) cout<<a<<endl
#define pr2(a,b) cout<<a<<" "<<b<<endl
#define pb push_back
#define pii pair<int,int>
#define pi acos(-1.0)
#define PI 3.1415926535897932385
#define Sin(a) sin((pi*a)/180)
#define siz 1000001
#define mem(ar) memset(ar,0,sizeof ar)
#define one(x) __builtin_popcount(x)
typedef long long ll;
using namespace std;
//int dx[]= {-1,-1,0,0,1,1};
//int dy[]= {-1,0,-1,1,0,1};
//int dx[]= {0,0,1,-1};/*4 side move*/
//int dy[]= {-1,1,0,0};/*4 side move*/
//int dx[]= {1,1,0,-1,-1,-1,0,1};/*8 side move*/
//int dy[]= {0,1,1,1,0,-1,-1,-1};/*8 side move*/
//int dx[]={1,1,2,2,-1,-1,-2,-2};/*knight move*/
//int dy[]={2,-2,1,-1,2,-2,1,-1};/*knight move*/
map<ll,bool>visi;
map<string,int>vis;
int main()
{

    //freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
    int  i,j,n,m,a,c,b,d,ck,t,r,x,y,ans,rem,cnt,lo,hi,sum,cs=1;
    string st;
    si(n),si(m);
    for(i=0; i<n; i++)
    {
        cin>>st;
        vis[st]=1;
    }
    r=0;
    for(i=0; i<m; i++)
    {
        cin>>st;
        if(vis[st]==0) r++;
    }
    if(n>m) printf("YES\n");
    else if(n<m)  printf("NO\n");
    else
    {
        n=n-r;
        m=m-r;
        if(n>=m) printf("YES\n");
        else
            printf("NO\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
string s;
map<string,int>freq;
//int freq[110],s;
int main(){
    int n,m;
    cin>>n>>m;
    int p=n,q=m;
    for(int i=0;i<n+m; i++){
        cin>>s;
        if(freq[s]==0){

           freq[s]++;
           continue;
        }
        else if(i<n){
            p--;
            freq[s]++;
       }
       else{
           q--;
           freq[s]++;
       }
    }
    if(p>q){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
return 0;
}


#include <iostream>
#include <map>
#include <string>
using namespace std;
string s;
int main(){
    map<string,int>freq;
    int n,m;
    cin>>n>>m;
    int p=n,q=m;
    for(int i=0;i<n+m; i++){
        cin>>s;
        if(freq[s]==0){

           freq[s]++;
           continue;
        }
        else if(i<n){
            p--;
            freq[s]++;
       }
       else{
           q--;
           freq[s]++;
       }
    }
    if(p>q){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
return 0;
}


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

int main(){
    int a,b,c,k,n,m,t=0;
    string s[1000],s1[1000];
    cin>>n>>m;
    for(int i=0;i<n;i++) cin>>s[i];
    for(int i=0;i<m;i++) cin>>s1[i];
    for(int j=0;j<n;j++) for(int i=0;i<m;i++) if(s[i]==s1[j])k++;
    n-=k;
    m-=k;
    n=n+(k%2);
    if(n>m) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


#include <iostream>
#include <map>
#include <string>
using namespace std;
string s;
int main(){
    map<string,int>freq;
    int n,m;
    cin>>n>>m;
    int p=n,q=m;
    for(int i=0;i<n+m; i++){
        cin>>s;
        if(freq[s]==0){

           freq[s]++;
           continue;
        }
        else if(i<n){
            p--;
            freq[s]++;
       }
       else{
           q--;
           freq[s]++;
       }
    }
    if(p>=q){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
return 0;
}


#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
const int MaxN = 1e4 + 5;
int n,m;
char p[MaxN][55],e[MaxN][55];
int main(){
	while(~(scanf("%d%d",&n,&m))){
		if(n==0&&m==0)
			break;
		for(int i = 1;i<=n;i++)
			scanf("%s",&p[i]);
		for(int i = 1;i<=m;i++)
			scanf("%s",&e[i]);
		for(int i = 1;i<=n;i++)
			for(int j = i+1;j<=n;j++){
				if(strcmp(p[i],p[j])==0)
					n--;
			}
		for(int i = 1;i<=m;i++)
			for(int j = i+1;j<=m;j++){
				if(strcmp(e[i],e[j])==0)
					m--;
			}
		if(n>m)
			printf("YES\n");
		else if(n<m)
			printf("NO\n");
		else if(n==m)
		{
			int blag=0,cnt=0;
			for(int i=1;i<=n;i++)
			{
				blag=0;
				for(int j=1;j<=m;j++)
					if(strcmp(p[i],e[j])==0)
					{
						blag=1;
						break;
					}
				if(blag)
					cnt++;
			}
			if(cnt%2)
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
}


#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
const int MaxN = 1e3 + 5;
int n,m;
char p[MaxN][505],e[MaxN][505];
int main(){
	while(~(scanf("%d%d",&n,&m))){
		for(int i = 1;i<=n;i++)
			scanf("%s",&p[i]);
		for(int i = 1;i<=m;i++)
			scanf("%s",&e[i]);
		for(int i = 1;i<=n;i++)
			for(int j = i+1;j<=n;j++){
				if(strcmp(p[i],p[j])==0)
					n--;
			}
		for(int i = 1;i<=m;i++)
			for(int j = i+1;j<=m;j++){
				if(strcmp(e[i],e[j])==0)
					m--;
			}
    if(n>m)
    	printf("YES\n");
    	else if(n<m)
    		printf("NO\n");
    		else if(n==m){
    			int flag = 0,cnt = 0;
    			for(int i = 1;i<=n;i++){
    				for(int j = 1;j<=m;j++){
    					if(strcmp(p[i],e[j])==0){
    						flag = 1;
    						cnt++;
    						}
    					}
    				}
    				if(cnt%2)
    					printf("YES\n");
    					else
    						printf("NO\n");

    			}
	}
}


#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
const int MaxN = 1e4 + 5;
int n,m;
int main(){
	while(~(scanf("%d%d",&n,&m))){
		char p[MaxN][55],e[MaxN][55];
		if(n==0&&m==0)
			break;
		for(int i = 0;i<n;i++)
			scanf("%s",&p[i]);
		for(int i = 0;i<m;i++)
			scanf("%s",&e[i]);
		for(int i = 0;i<n;i++)
			for(int j = i+1;j<n;j++){
				if(strcmp(p[i],p[j])==0)
					n--;
			}
		for(int i = 0;i<m;i++)
			for(int j = i+1;j<m;j++){
				if(strcmp(e[i],e[j])==0)
					m--;
			}
		if(n>m)
			printf("YES\n");
		else if(n<m)
			printf("NO\n");
		else if(n==m)
		{
			int blag=0,cnt=0;
			for(int i=0;i<n;i++)
			{
				blag=0;
				for(int j=0;j<m;j++)
					if(strcmp(p[i],e[j])==0)
					{
						blag=1;
						break;
					}
				if(blag)
					cnt++;
			}
			if(cnt%2)
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
    int n,m;
    while(cin>>n>>m)
    {
        char a[1005][505],b[1005][505];
        for(int i=0;i<n;i++)
          cin>>a[i];
        for(int i=0;i<m;i++)
          cin>>b[i];
        for(int i=0;i<n;i++)
          for(int j=i+1;j<n;j++)
            if(strcmp(a[i],a[j])==0)
              n--;
        for(int i=0;i<m;i++)
          for(int j=i+1;j<m;j++)
            if(strcmp(b[i],b[j])==0)
              m--;
        if(n>m)
          cout<<"YES"<<endl;
        else if(n==m)
        {
            int blag=0,cnt=0;
            for(int i=0;i<n;i++)
            {
                blag=0;
                for(int j=0;j<m;j++)
                  if(strcmp(a[i],b[j])==0)
                  {
                      blag=1;
                      break;
                  }
                if(blag)     //统计A和B拥有相同卡片的数目
                  cnt++;
          }
          if(cnt%2)         //因为是A先出，如果相同卡片数目为偶数，那么到最后肯定是B有一张卡片出不出，A就会获胜
            cout<<"YES"<<endl;
          else
            cout<<"NO"<<endl;
        }
        else
          cout<<"NO"<<endl;
    }
    return 0;
}


#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
const int MaxN = 1e4 + 5;
int n,m;
char p[MaxN][55],e[MaxN][55];
int main(){
	while(~(scanf("%d%d",&n,&m))){
		if(n==0&&m==0)
			break;
		for(int i = 0;i<n;i++)
			scanf("%s",&p[i]);
		for(int i = 0;i<m;i++)
			scanf("%s",&e[i]);
		for(int i = 0;i<n;i++)
			for(int j = i+1;j<n;j++){
				if(strcmp(p[i],p[j])==0)
					n--;
			}
		for(int i = 0;i<m;i++)
			for(int j = i+1;j<m;j++){
				if(strcmp(e[i],e[j])==0)
					m--;
			}
		if(n>m)
			printf("YES\n");
		else if(n<m)
			printf("NO\n");
		else if(n==m)
		{
			int blag=0,cnt=0;
			for(int i=0;i<n;i++)
			{
				blag=0;
				for(int j=0;j<m;j++)
					if(strcmp(p[i],e[j])==0)
					{
						blag=1;
						break;
					}
				if(blag)
					cnt++;
			}
			if(cnt%2)
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
}


#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
const int MaxN = 1e4 + 5;
int n,m;
char p[MaxN][55],e[MaxN][55];
int main(){
	while(~(scanf("%d%d",&n,&m))){
		if(n==0&&m==0)
			break;
		for(int i = 1;i<=n;i++)
			scanf("%s",&p[i]);
		for(int i = 1;i<=m;i++)
			scanf("%s",&e[i]);
		for(int i = 1;i<=n;i++)
			for(int j = i+1;j<=n;j++){
				if(strcmp(p[i],p[j])==0)
					n--;
			}
		for(int i = 1;i<=m;i++)
			for(int j = i+1;j<=m;j++){
				if(strcmp(e[i],e[j])==0)
					m--;
			}
		if(n>m)
			printf("YES\n");
		else if(n<m)
			printf("NO\n");
		else if(n==m){
			int flag = 0,cnt = 0;
			for(int i = 1;i<=n;i++){
				flag = 0;
				for(int j = 1;j<=m;j++){
					if(strcmp(p[i],e[j])==0){
						flag = 1;
						break;
					}
				}
				if(flag)
					cnt++;
			}
			if(cnt%2)
				printf("YES\n");
			else
				printf("NO\n");

		}
	}
}


#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
int main()
{
    int n,m;
    while(~scanf("%d%d",&n,&m)){
        char a[1005][505],b[1005][505];
        for(int i=0;i<n;i++)
          scanf("%s",&a[i]);
        for(int i=0;i<m;i++)
          scanf("%s",&b[i]);
        for(int i=0;i<n;i++)
          for(int j=i+1;j<n;j++)
            if(strcmp(a[i],a[j])==0)
              n--;
        for(int i=0;i<m;i++)
          for(int j=i+1;j<m;j++)
            if(strcmp(b[i],b[j])==0)
              m--;
        if(n>m)
          printf("YES\n");
        else if(n==m)
        {
            int blag=0,cnt=0;
            for(int i=0;i<n;i++)
            {
                blag=0;
                for(int j=0;j<m;j++)
                  if(strcmp(a[i],b[j])==0)
                  {
                      blag=1;
                      break;
                  }
                if(blag)
                  cnt++;
          }
          if(cnt%2)
            printf("YES\n");
          else
            printf("NO\n");
        }
        else
          printf("YES\n");
    }
}


/*
    Shakti Mani Tripathi
    B.Tech 2nd Year Electrical Engineering
    Handle ID: smtcoder
    MNNIT Allahabad
    Relationship Status: Single :P
*/
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mem(x,y) memset(x,y,sizeof(x))
#define lli long long
#define li long
#define mapii map<int,int>
#define mapllii map<long long int,int>
#define mapilli map<int,long long int>
#define mapllilli map<long long int,long long int>
#define vi vector <int>
#define vlli vector <long long int>
#define pii pair<int,int>
#define pilli pair<int,long long int>
#define pllii pair<long long int int,int>
#define pllilli pair<long long int,long long int>
#define ch char
#define frp(x,y,z) for(x=y;x<z;x++)
#define frm(x,y,z) for(x=y;x>z;x--)
#define mmax 1000000009
#define mmin -1000000009
#define pr printf
#define mod 1000000007
#define gc getchar
using namespace std;
void sc(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
using namespace std;
int main()
{
    int n,m,i;
    char stri[1000];
    set<string> str;
    sc(n);
    sc(m);
    frp(i,0,n+m)
    {cin>>stri;
    str.insert(stri);
    }
    if(str.size()-n<m)
        pr("NO\n");
    else
        pr("YES\n");
    return 0;
}


/*
    Shakti Mani Tripathi
    B.Tech 2nd Year Electrical Engineering
    Handle ID: smtcoder
    MNNIT Allahabad
    Relationship Status: Single :P
*/
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mem(x,y) memset(x,y,sizeof(x))
#define lli long long
#define li long
#define mapii map<int,int>
#define mapllii map<long long int,int>
#define mapilli map<int,long long int>
#define mapllilli map<long long int,long long int>
#define vi vector <int>
#define vlli vector <long long int>
#define pii pair<int,int>
#define pilli pair<int,long long int>
#define pllii pair<long long int int,int>
#define pllilli pair<long long int,long long int>
#define ch char
#define frp(x,y,z) for(x=y;x<z;x++)
#define frm(x,y,z) for(x=y;x>z;x--)
#define mmax 1000000009
#define mmin -1000000009
#define pr printf
#define mod 1000000007
#define gc getchar
using namespace std;
void sc(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
using namespace std;
int main()
{
    int n,m,i;
    char stri[1000];
    set<string> str;
    sc(n);
    sc(m);
    frp(i,0,n+m)
    {cin>>stri;
    str.insert(stri);
    }
    if(n<m)
        pr("NO\n");
    if(n>m)
        pr("YES\n");
    if(n==m)
    {if(str.size()%2==0)
        pr("NO\n");
    if(str.szie()%2!=0)
        pr("YES\n");}
    return 0;
}


/*
    Shakti Mani Tripathi
    B.Tech 2nd Year Electrical Engineering
    Handle ID: smtcoder
    MNNIT Allahabad
    Relationship Status: Single :P
*/
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mem(x,y) memset(x,y,sizeof(x))
#define lli long long
#define li long
#define mapii map<int,int>
#define mapllii map<long long int,int>
#define mapilli map<int,long long int>
#define mapllilli map<long long int,long long int>
#define vi vector <int>
#define vlli vector <long long int>
#define pii pair<int,int>
#define pilli pair<int,long long int>
#define pllii pair<long long int int,int>
#define pllilli pair<long long int,long long int>
#define ch char
#define frp(x,y,z) for(x=y;x<z;x++)
#define frm(x,y,z) for(x=y;x>z;x--)
#define mmax 1000000009
#define mmin -1000000009
#define pr printf
#define mod 1000000007
#define gc getchar
using namespace std;
void sc(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
using namespace std;
int main()
{
    int n,m,i;
    char stri[1000];
    set<string> str;
    sc(n);
    sc(m);
    frp(i,0,n+m)
    {cin>>stri;
    str.insert(stri);
    }
    if(str.size()%2==0)
        pr("NO\n");
    else
        pr("YES\n");
    return 0;
}


/*
    Shakti Mani Tripathi
    B.Tech 2nd Year Electrical Engineering
    Handle ID: smtcoder
    MNNIT Allahabad
    Relationship Status: Single :P
*/
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mem(x,y) memset(x,y,sizeof(x))
#define lli long long
#define li long
#define mapii map<int,int>
#define mapllii map<long long int,int>
#define mapilli map<int,long long int>
#define mapllilli map<long long int,long long int>
#define vi vector <int>
#define vlli vector <long long int>
#define pii pair<int,int>
#define pilli pair<int,long long int>
#define pllii pair<long long int int,int>
#define pllilli pair<long long int,long long int>
#define ch char
#define frp(x,y,z) for(x=y;x<z;x++)
#define frm(x,y,z) for(x=y;x>z;x--)
#define mmax 1000000009
#define mmin -1000000009
#define pr printf
#define mod 1000000007
#define gc getchar
using namespace std;
void sc(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
using namespace std;
int main()
{
    int n,m,i;
    char stri[1000];
    set<string> str;
    sc(n);
    sc(m);
    frp(i,0,n+m)
    {cin>>stri;
    str.insert(stri);
    }
    if(n<m)
        pr("NO\n");
    if(n>m)
        pr("YES\n");
    if(n==m)
    {if(str.size()%2==0)
        pr("NO\n");
    if(str.size()%2!=0)
        pr("YES\n");}
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    //freopen("input.txt", "r", stdin);
    int a, b;
    cin >> a >> b;
    string astr[1100], bstr[1100];
    int anum[1100], bnum[1100];

    for (int i = 0; i < a; ++i)
    {
        cin >> astr[i];
        anum[i] = i;
    }
    for (int i = 0; i < b; ++i)
    {
        cin >> bstr[i];
        bnum[i] = i;
    }

    for (int i = 0; i < a - 1; ++i)
        for (int j = i + 1; j < a; ++j)
        {
            if (astr[anum[i]] > astr[anum[j]])
            {
                int tmp = anum[i];
                anum[i] = anum[j];
                anum[j] = tmp;
            }
        }
    for (int i = 0; i < b - 1; ++i)
        for (int j = i + 1; j < b; ++j)
        {
            if (bstr[bnum[i]] > bstr[bnum[j]])
            {
                int tmp = bnum[i];
                bnum[i] = bnum[j];
                bnum[j] = tmp;
            }
        }
  /*  for (int i = 0; i< a; i++)
        cout << astr[anum[i]]<<endl;
    for (int i = 0; i< b; i++)
        cout << bstr[bnum[i]]<<endl;
*/

    int ain = 0, bin = 0, same = 0;

    while (ain < a && bin < b )
        if (astr[anum[ain]] > bstr[bnum[bin]])
            bin++;
        else if (astr[anum[ain]] < bstr[bnum[bin]])
            ain++;
        else if (astr[anum[ain]] == bstr[bnum[bin]])
        {
            ain++;
            bin++;
            same++;
        }

    //cout << same;
    a += same % 2;

   // cout<< same <<endl;
    if (a > b)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{

    int a, b;
    cin >> a >> b;
    string astr[1100], bstr[1100];
    int anum[1100], bnum[1100];

    for (int i = 0; i < a; ++i)
    {
        cin >> astr[i];
        anum[i] = i;
    }
    for (int i = 0; i < b; ++i)
    {
        cin >> bstr[i];
        bnum[i] = i;
    }

    for (int i = 0; i < a - 1; ++i)
        for (int j = i + 1; j < a; ++j)
        {
            if (astr[anum[i]] > astr[anum[j]])
            {
                int tmp = anum[i];
                anum[i] = anum[j];
                anum[j] = tmp;
            }
        }
    for (int i = 0; i < b - 1; ++i)
        for (int j = i + 1; j < b; ++j)
        {
            if (bstr[bnum[i]] > bstr[bnum[j]])
            {
                int tmp = bnum[i];
                bnum[i] = bnum[j];
                bnum[j] = tmp;
            }
        }

    int ain = 0, bin = 0, same = 0;

    while (ain < a && bin < b)
        if (astr[ain] > bstr[bin])
            bin++;
        else if (astr[ain] < bstr[bin])
            ain++;
        else
        {
            ain++;
            bin++;
            same++;
        }

    a += same % 2;

    if (a > b)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{

    int a, b = 0;
    cin >> a >> b;
    /*string astr[500], bstr[500];
    int anum[500], bnum[500];

    for (int i = 0; i < a; ++i)
    {
        cin >> astr[i];
        anum[i] = i;
    }
    for (int i = 0; i < b; ++i)
    {
        cin >> bstr[i];
        bnum[i] = i;
    }

    for (int i = 0; i < a - 1; ++i)
        for (int j = i + 1; j < a; ++j)
        {
            if (astr[anum[i]] > astr[anum[j]])
            {
                int tmp = anum[i];
                anum[i] = anum[j];
                anum[j] = tmp;
            }
        }
    for (int i = 0; i < a; ++i)
        cout << astr[anum[i]] << endl;
        */
    if (b > a)
        cout << "NO";
    else cout << "YES";
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    freopen("input.txt", "r", stdin);
    int a, b;
    cin >> a >> b;
    string astr[1100], bstr[1100];
    int anum[1100], bnum[1100];

    for (int i = 0; i < a; ++i)
    {
        cin >> astr[i];
        anum[i] = i;
    }
    for (int i = 0; i < b; ++i)
    {
        cin >> bstr[i];
        bnum[i] = i;
    }

    for (int i = 0; i < a - 1; ++i)
        for (int j = i + 1; j < a; ++j)
        {
            if (astr[anum[i]] > astr[anum[j]])
            {
                int tmp = anum[i];
                anum[i] = anum[j];
                anum[j] = tmp;
            }
        }
    for (int i = 0; i < b - 1; ++i)
        for (int j = i + 1; j < b; ++j)
        {
            if (bstr[bnum[i]] > bstr[bnum[j]])
            {
                int tmp = bnum[i];
                bnum[i] = bnum[j];
                bnum[j] = tmp;
            }
        }
  /*  for (int i = 0; i< a; i++)
        cout << astr[anum[i]]<<endl;
    for (int i = 0; i< b; i++)
        cout << bstr[bnum[i]]<<endl;
*/

    int ain = 0, bin = 0, same = 0;

    while (ain < a && bin < b )
        if (astr[anum[ain]] > bstr[bnum[bin]])
            bin++;
        else if (astr[anum[ain]] < bstr[bnum[bin]])
            ain++;
        else if (astr[anum[ain]] == bstr[bnum[bin]])
        {
            ain++;
            bin++;
            same++;
        }

    //cout << same;
    a += same % 2;

   // cout<< same <<endl;
    if (a > b)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{

    int a, b;
    cin >> a >> b;
    string astr[500], bstr[500];
    int anum[500], bnum[500];

    for (int i = 0; i < a; ++i)
    {
        cin >> astr[i];
        anum[i] = i;
    }
    for (int i = 0; i < b; ++i)
    {
        cin >> bstr[i];
        bnum[i] = i;
    }

    for (int i = 0; i < a - 1; ++i)
        for (int j = i + 1; j < a; ++j)
        {
            if (astr[anum[i]] > astr[anum[j]])
            {
                int tmp = anum[i];
                anum[i] = anum[j];
                anum[j] = tmp;
            }
        }
    for (int i = 0; i < b - 1; ++i)
        for (int j = i + 1; j < b; ++j)
        {
            if (bstr[bnum[i]] > bstr[bnum[j]])
            {
                int tmp = bnum[i];
                bnum[i] = bnum[j];
                bnum[j] = tmp;
            }
        }

    int ain = 0, bin = 0, same = 0;

    while (ain <= a && bin <= b)
        if (astr[ain] > bstr[bin])
            bin++;
        else if (astr[ain] < bstr[bin])
            ain++;
        else
        {
            ain++;
            bin++;
            same++;
        }

    a += same % 2;

    if (a > b)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{

    int a, b;
    cin >> a >> b;
    string astr[1100], bstr[1100];
    int anum[1100], bnum[1100];

    for (int i = 0; i < a; ++i)
    {
        cin >> astr[i];
        anum[i] = i;
    }
    for (int i = 0; i < b; ++i)
    {
        cin >> bstr[i];
        bnum[i] = i;
    }

    for (int i = 0; i < a - 1; ++i)
        for (int j = i + 1; j < a; ++j)
        {
            if (astr[anum[i]] > astr[anum[j]])
            {
                int tmp = anum[i];
                anum[i] = anum[j];
                anum[j] = tmp;
            }
        }
    for (int i = 0; i < b - 1; ++i)
        for (int j = i + 1; j < b; ++j)
        {
            if (bstr[bnum[i]] > bstr[bnum[j]])
            {
                int tmp = bnum[i];
                bnum[i] = bnum[j];
                bnum[j] = tmp;
            }
        }

    int ain = 0, bin = 0, same = 0;

    while (ain < a && bin < b )
        if (astr[ain] > bstr[bin])
            bin++;
        else if (astr[ain] < bstr[bin])
            ain++;
        else if (astr[ain] == bstr[bin])
        {
            ain++;
            bin++;
            same++;
        }

    a += same % 2;

   // cout<< same <<endl;
    if (a > b)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{

    int a, b;
    cin >> a >> b;
    string astr[1100], bstr[1100];
    int anum[1100], bnum[1100];

    for (int i = 0; i < a; ++i)
    {
        cin >> astr[i];
        anum[i] = i;
    }
    for (int i = 0; i < b; ++i)
    {
        cin >> bstr[i];
        bnum[i] = i;
    }

    for (int i = 0; i < a - 1; ++i)
        for (int j = i + 1; j < a; ++j)
        {
            if (astr[anum[i]] > astr[anum[j]])
            {
                int tmp = anum[i];
                anum[i] = anum[j];
                anum[j] = tmp;
            }
        }
    for (int i = 0; i < b - 1; ++i)
        for (int j = i + 1; j < b; ++j)
        {
            if (bstr[bnum[i]] > bstr[bnum[j]])
            {
                int tmp = bnum[i];
                bnum[i] = bnum[j];
                bnum[j] = tmp;
            }
        }

    int ain = 0, bin = 0, same = 0;

    while (ain <= a && bin <= b)
        if (astr[ain] > bstr[bin])
            bin++;
        else if (astr[ain] < bstr[bin])
            ain++;
        else
        {
            ain++;
            bin++;
            same++;
        }

    a += same % 2;

    if (a > b)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{

    int a, b;
    cin >> a >> b;
    string astr[1100], bstr[1100];
    int anum[1100], bnum[1100];

    for (int i = 0; i < a; ++i)
    {
        cin >> astr[i];
        anum[i] = i;
    }
    for (int i = 0; i < b; ++i)
    {
        cin >> bstr[i];
        bnum[i] = i;
    }
    astr[a] = '\1';
    bstr[b] = '\2';

    for (int i = 0; i < a - 1; ++i)
        for (int j = i + 1; j < a; ++j)
        {
            if (astr[anum[i]] > astr[anum[j]])
            {
                int tmp = anum[i];
                anum[i] = anum[j];
                anum[j] = tmp;
            }
        }
    for (int i = 0; i < b - 1; ++i)
        for (int j = i + 1; j < b; ++j)
        {
            if (bstr[bnum[i]] > bstr[bnum[j]])
            {
                int tmp = bnum[i];
                bnum[i] = bnum[j];
                bnum[j] = tmp;
            }
        }

    int ain = 0, bin = 0, same = 0;

    while (ain <= a && bin <= b )
        if (astr[ain] > bstr[bin])
            bin++;
        else if (astr[ain] < bstr[bin])
            ain++;
        else if (astr[ain] == bstr[bin])
        {
            ain++;
            bin++;
            same++;
        }

    a += same % 2;

   // cout<< same <<endl;
    if (a > b)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


/*************************************************************************************
                         ---------------------------
                   ------Bismillahir-Rahmanir-Rahim------
                         ---------------------------

                    U         U            M           M
                    U         U            M  M     M  M
                    U         U            M     M     M
                    U         U            M           M
                    U         U            M           M
                    U         U   *        M           M     *
                    U         U  * *       M           M    * *
                      U  U  U     *        M           M     *
    -----------------------------------------------------------------------
            //     //   Name: MD: MEHEDI HASAN              //     //
           //     //    Institute: HSTU                    //     //
          //     //     Dept.: CSE                        //     //
         //     //      Email: mehedi1502032@gmail.com   //     //
    -----------------------------------------------------------------------
            ---------- I Love Programming as Gaming ----------
**************************************************************************************/
#include<bits/stdc++.h>
/*#include<algorithm>
#include<iostream>
#include <sstream>
#include<iomanip>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<sstream>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<limits>
#include<queue>
#include<cmath>
#include<stack>
#include<ctime>
#include<list>
#include<map>
#include<set>
*/

using namespace std;

#define loop(a,b,c) for(int a=b;a<c;a++)
#define lloop(a,b,c) for(long long a=b;a<c;a++)
#define rloop(a,b,c) for(int a=c-1;a>=b;a--)
#define rlloop(a,b,c) for(long long a=c-1;a>=b;a--)
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define EPS 1e-9
#define PI acos(-1)
#define rn PI/180
#define TC(t) scanf("%d",&t);while(t--)
#define sf scanf
#define pf printf
#define SIZE 100001
#define sp ' '
#define nl printf("\n")
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ff first
#define ss second
#define gcd(a,b) __gcd(a,b)
#define b_s(v,x) binary_search(v.begin(),v.end(),x)
#define l_b(v,x) lower_bound(v.begin(),v.end(),x)
#define u_b(v,x) upper_bound(v.begin(),v.end(),x)
#define e_r(v,x) equal_range(v.begin(),v.end(),x)
#define faster ios_base::sync_with_stdio(0);cin.tie(false);cout.tie(false);

/// ASCII Vlaue....
/// A=65,Z=90,a=97,z=122,0=48,9=57
///#define INT_MAX 2147483647
///#define INT_MIN -2147483647

const int MOD=1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int>vi;
typedef vector<ll>vl;
typedef vector<string> vs;
typedef stack<int> si;
typedef stack<string> ss;
typedef queue<int> qi;
typedef queue<string> qs;
typedef pair<int,int> pii;
typedef pair<string,int>psi;
typedef map<int,int>mii;
typedef map<string,int>msi;

/**ll nCr(ll aan, ll aar)
{
    ll ii, aac=1;
    for(ii=1; ii<=aar; ii++)
    {
        aac*=(aan-aar+ii);
        aac/=ii;
    }
    return aac;
}

bool status[1100002];
void siv()
{
	int N=1000000;
	int sq=sqrt(N);
	for(int i=4;i<=N;i+=2) status[i]=1;
	for(int i=3;i<=sq;i+=2){
		if(status[i]==0)
		{
			for(int j=i*i;j<=N;j+=i) status[j]=1;
		}
	}
	status[1]=1;
}

ll big_mod(ll base, ll power, ll mod)
{
    if(power==0) return 1;
    if(power&1)
    {
        ll p1=base%mod;
        ll p2=(big_mod(base, power-1,mod))%mod;
        return (p1*p2)%mod;
    }
    else
    {
        ll p1=(big_mod(base,power/2,mod))%mod;
        return (p1*p1)%mod;
    }
}
ll modInverseBigMod(ll a,ll m)  //a*x=1(mod m)
{
    return big_mod(a,m-2,m);
}**/

///START YOUR CODE FROM HERE.... Happy Coding.... ! ;)

int main()
{
    faster   ///Don't use scanf and printf;
    int n,m;
    while(cin>>n>>m)
    {
        map<int,string>pb,eb;
        map<string,int>store;
        string s;
        int cnt=0;
        loop(i,1,n+1)
        {
            cin>>s;
            pb[i]=s;
        }
        int b=0,a=0;
        loop(i,1,m+1)
        {
            cin>>s;
            eb[i]=s;
            /*if(pb.find(s)==pb.end())
            {
                b++;
            }
            else
            {
                if(pb[s]<=i);/// {b++;}
                else {a--;b++;}
            }*/
        }
        int i,j;
        bool ck;
        for(i=1,j=1;i<=n||j<=m;)
        {
            ///s=pb[i];
            if(store.find(pb[i])==store.end()&&i<=n) {store[pb[i]]=1;i++;a++;ck=true;}
            else
            {
                while(i<=n)
                {
                    if(store.find(pb[i])==store.end()) {store[pb[i]]=1;i++;a++; ck=true; break;}
                    else i++;
                }
                ///if(store.find(pb[i])==store.end()) {store[pb[i]]=1;i++;a++;}

            }
            if(store.find(eb[j])==store.end()&&j<=m) {store[eb[j]]=1;j++;b++;ck=false;}
            else
            {
                while(j<=m)
                {
                    if(store.find(eb[j])==store.end()) {store[eb[j]]=1;j++;b++; ck=false; break;}
                    else j++;
                }
            }
        }

        ///cout<<a<<" "<<b<<endl;
        if(ck) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;

    }
    return 0;
}


/*************************************************************************************
                         ---------------------------
                   ------Bismillahir-Rahmanir-Rahim------
                         ---------------------------

                    U         U            M           M
                    U         U            M  M     M  M
                    U         U            M     M     M
                    U         U            M           M
                    U         U            M           M
                    U         U   *        M           M     *
                    U         U  * *       M           M    * *
                      U  U  U     *        M           M     *
    -----------------------------------------------------------------------
            //     //   Name: MD: MEHEDI HASAN              //     //
           //     //    Institute: HSTU                    //     //
          //     //     Dept.: CSE                        //     //
         //     //      Email: mehedi1502032@gmail.com   //     //
    -----------------------------------------------------------------------
            ---------- I Love Programming as Gaming ----------
**************************************************************************************/
#include<bits/stdc++.h>
/*#include<algorithm>
#include<iostream>
#include <sstream>
#include<iomanip>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<sstream>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<limits>
#include<queue>
#include<cmath>
#include<stack>
#include<ctime>
#include<list>
#include<map>
#include<set>
*/

using namespace std;

#define loop(a,b,c) for(int a=b;a<c;a++)
#define lloop(a,b,c) for(long long a=b;a<c;a++)
#define rloop(a,b,c) for(int a=c-1;a>=b;a--)
#define rlloop(a,b,c) for(long long a=c-1;a>=b;a--)
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define EPS 1e-9
#define PI acos(-1)
#define rn PI/180
#define TC(t) scanf("%d",&t);while(t--)
#define sf scanf
#define pf printf
#define SIZE 100001
#define sp ' '
#define nl printf("\n")
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ff first
#define ss second
#define gcd(a,b) __gcd(a,b)
#define b_s(v,x) binary_search(v.begin(),v.end(),x)
#define l_b(v,x) lower_bound(v.begin(),v.end(),x)
#define u_b(v,x) upper_bound(v.begin(),v.end(),x)
#define e_r(v,x) equal_range(v.begin(),v.end(),x)
#define faster ios_base::sync_with_stdio(0);cin.tie(false);cout.tie(false);

/// ASCII Vlaue....
/// A=65,Z=90,a=97,z=122,0=48,9=57
///#define INT_MAX 2147483647
///#define INT_MIN -2147483647

const int MOD=1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int>vi;
typedef vector<ll>vl;
typedef vector<string> vs;
typedef stack<int> si;
typedef stack<string> ss;
typedef queue<int> qi;
typedef queue<string> qs;
typedef pair<int,int> pii;
typedef pair<string,int>psi;
typedef map<int,int>mii;
typedef map<string,int>msi;

/**ll nCr(ll aan, ll aar)
{
    ll ii, aac=1;
    for(ii=1; ii<=aar; ii++)
    {
        aac*=(aan-aar+ii);
        aac/=ii;
    }
    return aac;
}

bool status[1100002];
void siv()
{
	int N=1000000;
	int sq=sqrt(N);
	for(int i=4;i<=N;i+=2) status[i]=1;
	for(int i=3;i<=sq;i+=2){
		if(status[i]==0)
		{
			for(int j=i*i;j<=N;j+=i) status[j]=1;
		}
	}
	status[1]=1;
}

ll big_mod(ll base, ll power, ll mod)
{
    if(power==0) return 1;
    if(power&1)
    {
        ll p1=base%mod;
        ll p2=(big_mod(base, power-1,mod))%mod;
        return (p1*p2)%mod;
    }
    else
    {
        ll p1=(big_mod(base,power/2,mod))%mod;
        return (p1*p1)%mod;
    }
}
ll modInverseBigMod(ll a,ll m)  //a*x=1(mod m)
{
    return big_mod(a,m-2,m);
}**/

///START YOUR CODE FROM HERE.... Happy Coding.... ! ;)

int main()
{
    faster   ///Don't use scanf and printf;
    int n,m;
    while(cin>>n>>m)
    {
        map<string,int>pb,eb;
        string s;
        int cnt=0;
        loop(i,1,n+1)
        {
            cin>>s;
            pb[s]=i;
        }
        int b=0,a=n;
        loop(i,1,m+1)
        {
            cin>>s;
            if(pb.find(s)==pb.end())
            {
                b++;
            }
            else
            {
                if(pb[s]<i) {b++; a--;}
            }
        }
        if(a>b) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;

    }
    return 0;
}


/*input
1
almba

*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int> vii;
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
string ans;
int n;
bool vis[26];
set<int>  adj[26];

void an(int i){
	vis[i] = true;
	if(adj[i].size()>2){
		ans = "";
		return;
	}
	ans+=(char)((char)(i) + 'a');
	for(auto x:adj[i]){
		if(!vis[x]){
			an(x);
		}
	}
}
void solve(){
    string s;cin>>s; n = s.size();
    adj[(int)(s[0]-'a')].insert(s[1]-'a');
    adj[(int)(s[n-1]-'a')].insert(s[n-2]-'a');
    for(int i=1;i<n-1;++i){
    	int j = s[i]-'a', p = s[i-1]-'a', ne= s[i+1]-'a';
    	adj[j].insert(p);
    	adj[j].insert(ne);
    }
    for(int i=0;i<26;++i){
    	if(adj[i].size()<2 && !vis[i]){
    		an(i);
    	}
    }
    if(ans.size()==26){
    	cout<<"YES\n";cout<<ans<<'\n';
    }
    else
    	cout<<"NO\n";
    ans = "";
    for(int i=0;i<26;++i){
    	adj[i].clear();
    	vis[i] = false;
    }

}

signed main(){
	IOS
	int t=1;
	cin>>t;
	while(t--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define FAST_IO ios_base::sync_with_stdio(),cout.tie(NULL),cin.tie(NULL);
set<int>g[26];
bool visited[26];
bool pos = true;
string final;
void dfs(int src) {
	visited[src] = true;
	final += 'a' + src;
	for (auto x : g[src]) {
		if (!visited[x]) {
			(dfs(x));
		}
	}
}

int main()
{
	FAST_IO;
	int t;
	cin >> t;
	while (t--) {
		final = "";
		pos = true;
		memset(visited, false, sizeof(visited));
		for (int i = 0; i < 26; i++)g[i].clear();
		string s;
		cin >> s;
		int n = s.length();
		for (int i = 1; i < n; i++)
		{
			int u = s[i - 1] - 'a';
			int v = s[i] - 'a';
			g[u].insert(v);
			g[v].insert(u);
		}
		int src = -1;
		for (int i = 0; i < 26; i++)
		{
			if (g[i].size() > 2)
			{
				pos = false;
			}
			if (g[i].size() == 1)
			{
				src = i;
			}
		}
		if (src == -1 && s.length() > 1)pos = false;
		else if (src != -1)dfs(src);
		for (int i = 0; i < 26; i++) {
			if (!visited[i]) {
				final += i + 'a';
			}
		}
		if (pos) {
			cout << "YES" << endl;
			cout << final << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define FAST_IO ios_base::sync_with_stdio(),cout.tie(NULL),cin.tie(NULL);
set<int>g[26];
bool visited[26];
bool pos = true;
string final;

bool dfs(int src, int parent) {
	visited[src] = true;
	final += 'a' + src;
	if (g[src].size() > 2)
	{
		pos = false;
	}
	for (auto x : g[src]) {
		if (!visited[x]) {
			if (dfs(x, src))return true;
		}
		else if (x != parent)return true;
	}
	return false;
}
int main()
{
	FAST_IO;
	int t;
	cin >> t;
	while (t--) {
		final = "";
		pos = true;
		memset(visited, false, sizeof(visited));
		for (int i = 0; i < 26; i++)g[i].clear();
		string s;
		cin >> s;
		int n = s.length();
		int src = 0;
		for (int i = 1; i < n; i++)
		{
			int u = s[i - 1] - 'a';
			int v = s[i] - 'a';
			g[u].insert(v);
			g[v].insert(u);
		}
		int cnt = 26;
		for (int i = 0; i < 26; i++)
		{
			if (!visited[i]) {
				pos &= !dfs(i,-1);
			}
		}

		if (pos) {
			cout << "YES" << endl;
			cout << final << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define FAST_IO ios_base::sync_with_stdio(),cout.tie(NULL),cin.tie(NULL);
set<int>g[26];
bool visited[26];
bool pos = true;
string final;
bool dfs(int src, int parent) {
	visited[src] = true;
	final += 'a' + src;
	for (auto x : g[src]) {
		if (!visited[x]) {
			if (dfs(x, src))return true;
		}
		else if (x != parent)return true;
	}
	return false;
}

int main()
{
	FAST_IO;
	int t;
	cin >> t;
	while (t--) {
		final = "";
		pos = true;
		memset(visited, false, sizeof(visited));
		for (int i = 0; i < 26; i++)g[i].clear();
		string s;
		cin >> s;
		int n = s.length();
		for (int i = 1; i < n; i++)
		{
			int u = s[i - 1] - 'a';
			int v = s[i] - 'a';
			g[u].insert(v);
			g[v].insert(u);
		}
		int src = -1;
		for (int i = 0; i < 26; i++)
		{
			if (g[i].size() > 2)
			{
				pos = false;
			}
			if (g[i].size() == 1)
			{
				src = i;
			}
		}
		if (src == -1)pos = false;
		else pos &= !dfs(src, -1);
		for (int i = 0; i < 26; i++) {
			if (!visited[i]) {
				final += i + 'a';
			}
		}
		if (pos) {
			cout << "YES" << endl;
			cout << final << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define FAST_IO ios_base::sync_with_stdio(),cout.tie(NULL),cin.tie(NULL);
set<int>g[26];
bool visited[26];
bool pos = true;
string final;
void dfs(int src) {
	visited[src] = true;
	final += 'a' + src;
	for (auto x : g[src]) {
		if (!visited[x]) {
			 (dfs(x));
			}
	}
}

int main()
{
	FAST_IO;
	int t;
	cin >> t;
	while (t--) {
		final = "";
		pos = true;
		memset(visited, false, sizeof(visited));
		for (int i = 0; i < 26; i++)g[i].clear();
		string s;
		cin >> s;
		int n = s.length();
		for (int i = 1; i < n; i++)
		{
			int u = s[i - 1] - 'a';
			int v = s[i] - 'a';
			g[u].insert(v);
			g[v].insert(u);
		}
		int src = -1;
		for (int i = 0; i < 26; i++)
		{
			if (g[i].size() > 2)
			{
				pos = false;
			}
			if (g[i].size() == 1)
			{
				src = i;
			}
		}
		if (src == -1)pos = false;
		else dfs(src);
		for (int i = 0; i < 26; i++) {
			if (!visited[i]) {
				final += i + 'a';
			}
		}
		if (pos) {
			cout << "YES" << endl;
			cout << final << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}