#include <iostream>
using namespace std;
int main()
{
int n, m, i = 0, k = 0;
bool p = true;
cin >> n >> m;
int v[m], g[m];
for (int i = 0; i < m; i ++)
{
cin >> v[i] >> g[i];
}
while (p)
{
for (int j = i+1; j < m; j ++)
{
if ( (v[i] == v[j]) && (g[i] == g[j]) )
{
k++;
cout<<"YES"<<endl;
p=false; //Выход из цикла.
}
}
i ++;
if (i == m) break; //Условие окончания цикла.
}
if (k == 0) cout<<"NO"<<endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSAKewoJaW50IG4sIG0sIGkgPSAwLCBrID0gMDsKCWJvb2wgcCA9IHRydWU7CgljaW4gPj4gbiA+PiBtOwoJaW50IHZbbV0sIGdbbV07Cglmb3IgKGludCBpID0gMDsgaSA8IG07IGkgKyspCgl7CgkJY2luID4+IHZbaV0gPj4gZ1tpXTsKCX0KCXdoaWxlIChwKQoJewoJCWZvciAoaW50IGogPSBpKzE7IGogPCBtOyBqICsrKQoJCXsKCQkJaWYgKCAodltpXSA9PSB2W2pdKSAmJiAoZ1tpXSA9PSBnW2pdKSApIAoJCQl7IAoJCQkJaysrOyAKCQkJCWNvdXQ8PCJZRVMiPDxlbmRsOyAKCQkJCXA9ZmFsc2U7IC8v0JLRi9GF0L7QtCDQuNC3INGG0LjQutC70LAuCgkJCX0KCQl9CgkJaSArKzsKCQlpZiAoaSA9PSBtKSBicmVhazsgLy/Qo9GB0LvQvtCy0LjQtSDQvtC60L7QvdGH0LDQvdC40Y8g0YbQuNC60LvQsC4KCX0KCWlmIChrID09IDApIGNvdXQ8PCJOTyI8PGVuZGw7CglyZXR1cm4gMDsKfQ==