# Include <stdio. h>
# Include <math. h>
# Include <stdlib. h>
# Define Max 2 <10 // This number cannot be too large or too small. When the two numbers are too large, they are out of range. The first value is 2 <29; the result is wa.
Int map [105] [105];
Int d [105] [105];
Int main (INT argc, char * argv [])
{
Int N, I, J, K, T, M;
Int A, B;
While (scanf ("% d", & N, & M )! = EOF ){
For (I = 0; I <105; I ++) // initialization ..
For (j = 0; j <105; j ++)
Map [I] [J] = max;
For (I = 0; I <m; I ++ ){
Scanf ("% d", & A, & B );
If (A = B)
Map [a] [B] = map [B] [a] = 0;
Else map [a] [B] = map [B] [a] = 1;
}
For (I = 0; I <n; I ++) // initialization...
For (j = 0; j <n; j ++)
If (I = J) d [I] [J] = 0;
Else d [I] [J] = d [J] [I] = map [I] [J];
For (k = 0; k <n; k ++) // freeloj's algorithm .. Don't mess up the order...
For (I = 0; I <n; I ++)
For (j = 0; j <n; j ++)
If (d [I] [J]> d [I] [k] + d [k] [J])
D [I] [J] = d [I] [k] + d [k] [J];
Int flag = 0;
For (I = 0; I <n; I ++ ){
For (j = 0; j <n; j ++)
If (d [I] [J]> 7) {// The question is separated by a maximum of six people, corresponding to Seven sides...
Flag = 1;
Break;
}
}
If (flag = 1)
Printf ("NO \ n ");
Else printf ("Yes \ n ");
}
Return 0;
}