int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int uf[1000000] = {[0 ... 999999] = -1};
  for (int i = 0; i < k; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    connect(uf, a - 1, b - 1);
  }
  int cap = n >> 1, valid = 1;
  for (int i = 0; i < cap; i++) {
    if (root(uf, i) != root(uf, n - 1 - i)) {
      valid = 0;
      break;
    }
  }
  printf(valid ? "Yes\n" : "No\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3d0930,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x3d0910(%rbp),%rdi
mov    $0xff,%esi
mov    $0x3d0900,%edx
call   1040 <memset@plt>
movl   $0x0,-0x3d0914(%rbp)
mov    -0x3d0914(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f7 <main+0xa7>
lea    0xe52(%rip),%rdi
lea    -0x3d0918(%rbp),%rsi
lea    -0x3d091c(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x3d0910(%rbp),%rdi
mov    -0x3d0918(%rbp),%esi
sub    $0x1,%esi
mov    -0x3d091c(%rbp),%edx
sub    $0x1,%edx
mov    $0x0,%al
call   1070 <connect@plt>
mov    -0x3d0914(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0914(%rbp)
jmp    1198 <main+0x48>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x3d0920(%rbp)
movl   $0x1,-0x3d0924(%rbp)
movl   $0x0,-0x3d0928(%rbp)
mov    -0x3d0928(%rbp),%eax
cmp    -0x3d0920(%rbp),%eax
jge    1295 <main+0x145>
lea    -0x3d0910(%rbp),%rdi
mov    -0x3d0928(%rbp),%esi
mov    $0x0,%al
call   1050 <root@plt>
mov    %eax,-0x3d092c(%rbp)
lea    -0x3d0910(%rbp),%rdi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
sub    -0x3d0928(%rbp),%esi
mov    $0x0,%al
call   1050 <root@plt>
mov    %eax,%ecx
mov    -0x3d092c(%rbp),%eax
cmp    %ecx,%eax
je     127c <main+0x12c>
movl   $0x0,-0x3d0924(%rbp)
jmp    1295 <main+0x145>
jmp    1281 <main+0x131>
mov    -0x3d0928(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0928(%rbp)
jmp    1217 <main+0xc7>
mov    -0x3d0924(%rbp),%ecx
lea    0xd69(%rip),%rdi
lea    0xd5d(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3d0930,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3d0918,%rsp
lea    0xe98(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0x10(%rsp),%rdi
mov    $0x3d0900,%edx
mov    $0xff,%esi
call   1040 <memset@plt>
cmpl   $0x0,(%rsp)
jle    11e0 <main+0x90>
lea    0xe68(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x10(%rsp),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
add    $0xffffffff,%esi
mov    0x8(%rsp),%edx
add    $0xffffffff,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <connect@plt>
add    $0x1,%ebp
cmp    (%rsp),%ebp
jl     11b0 <main+0x60>
mov    0x4(%rsp),%r12d
lea    0xe1a(%rip),%r14
cmp    $0x2,%r12d
jl     1248 <main+0xf8>
shr    %r12d
mov    $0xffffffff,%ebx
lea    0x10(%rsp),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <root@plt>
mov    %eax,%r13d
mov    0x4(%rsp),%esi
add    %ebx,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <root@plt>
cmp    %eax,%r13d
jne    1241 <main+0xf1>
add    $0x1,%ebp
add    $0xffffffff,%ebx
cmp    %ebp,%r12d
jne    1210 <main+0xc0>
jmp    1248 <main+0xf8>
lea    0xdc3(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3d0918,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [5 x i8] c"Yes\0A\00"
@.str.2 = [4 x i8] c"No\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000000 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%12 = bitcast [1000000 x i32]* %4 to i8*
store i32 0, i32* %5
br label %13
13: ; preds = %25, %0
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %7)
%19 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 0
%20 = load i32, i32* %6
%21 = sub nsw i32 %20, 1
%22 = load i32, i32* %7
%23 = sub nsw i32 %22, 1
%24 = call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @connect to i32 (i32*, i32, i32, ...)*)(i32* %19, i32 %21, i32 %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %13
28: ; preds = %13
%29 = load i32, i32* %2
%30 = ashr i32 %29, 1
store i32 %30, i32* %8
store i32 1, i32* %9
store i32 0, i32* %10
br label %31
31: ; preds = %48, %28
%32 = load i32, i32* %10
%33 = load i32, i32* %8
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %51
35: ; preds = %31
%36 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 0
%37 = load i32, i32* %10
%38 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @root to i32 (i32*, i32, ...)*)(i32* %36, i32 %37)
%39 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 0
%40 = load i32, i32* %2
%41 = sub nsw i32 %40, 1
%42 = load i32, i32* %10
%43 = sub nsw i32 %41, %42
%44 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @root to i32 (i32*, i32, ...)*)(i32* %39, i32 %43)
%45 = icmp ne i32 %38, %44
br i1 %45, label %46, label %47
46: ; preds = %35
store i32 0, i32* %9
br label %51
47: ; preds = %35
br label %48
48: ; preds = %47
%49 = load i32, i32* %10
%50 = add nsw i32 %49, 1
store i32 %50, i32* %10
br label %31
51: ; preds = %46, %31
%52 = load i32, i32* %9
%53 = icmp ne i32 %52, 0
%54 = zext i1 %53 to i64
%55 = select i1 %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%56 = call i32 (i8*, ...) @printf(i8* %55)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [5 x i8] c"Yes\0A\00"
@.str.2 = [4 x i8] c"No\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1000000 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%9 = bitcast [1000000 x i32]* %3 to i8*
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = bitcast i32* %4 to i8*
%14 = bitcast i32* %5 to i8*
%15 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %3, i64 0, i64 0
br label %22
16: ; preds = %22, %0
%17 = load i32, i32* %1
%18 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %3, i64 0, i64 0
%19 = icmp sgt i32 %17, 1
br i1 %19, label %20, label %44
20: ; preds = %16
%21 = lshr i32 %17, 1
br label %35
22: ; preds = %12, %22
%23 = phi i32 [ 0, %12 ], [ %30, %22 ]
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%25 = load i32, i32* %4
%26 = add nsw i32 %25, -1
%27 = load i32, i32* %5
%28 = add nsw i32 %27, -1
%29 = call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @connect to i32 (i32*, i32, i32, ...)*)(i32* %15, i32 %26, i32 %28)
%30 = add nuw nsw i32 %23, 1
%31 = load i32, i32* %2
%32 = icmp slt i32 %30, %31
br i1 %32, label %22, label %16
33: ; preds = %35
%34 = icmp eq i32 %43, %21
br i1 %34, label %44, label %35
35: ; preds = %20, %33
%36 = phi i32 [ %43, %33 ], [ 0, %20 ]
%37 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @root to i32 (i32*, i32, ...)*)(i32* %18, i32 %36)
%38 = load i32, i32* %1
%39 = xor i32 %36, -1
%40 = add i32 %38, %39
%41 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @root to i32 (i32*, i32, ...)*)(i32* %18, i32 %40)
%42 = icmp eq i32 %37, %41
%43 = add nuw nsw i32 %36, 1
br i1 %42, label %33, label %44
44: ; preds = %33, %35, %16
%45 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %16 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %35 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %33 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %45)
ret i32 0
}