1. 
/**
* FWP: Ausgewaehlte Probleme aus dem ACM (SS10)
*
* Problem: 11785-Hypercube
* Method: ad hoc
* Accepted: 0.648
* @author Evgeni Pavlidis
*
*/

import java.io.*;
import java.util.*;

class Main {

public static void main(String...args)
{
Scanner scanner = new Scanner(System.in);

int k,m;
int c,n,tmp;
boolean isHypercube;

while(true)
{
k = scanner.nextInt();
m = scanner.nextInt();
if(k == 0)
break;


isHypercube = true;

if((k & (k-1)) != 0)
isHypercube = false;

n = (int)(Math.log(k)/Math.log(2));
if(m != (k*n/2))
isHypercube = false;

for(int e = 0; e < m; e++)
{
c = scanner.nextInt() ^ scanner.nextInt();
if((c == 0) || (c & (c-1)) != 0)
isHypercube = false;
}


System.out.println((isHypercube)? "YES" : "NO");
}
}
}