#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
struct P {
  int in, out;
  bool operator!=(P B) const { return in != B.in || out != B.out; }
} p[N];
int nxt[N], vis[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (b < a) swap(a, b);
    if (b - a > n / 2.0) {
      p[b].in++;
      p[a].out++;
    } else if (b - a < n / 2.0) {
      p[a].in++;
      p[b].out++;
    } else {
      p[a].in++;
      p[b].out++;
      p[b].in++;
      p[a].out++;
    }
  }
  nxt[0] = -1;
  int j = -1;
  for (int i = 1; i <= n; i++) {
    while (j != -1 && p[i] != p[j + 1]) j = nxt[j];
    nxt[i] = ++j;
  }
  int t = nxt[n];
  while (t != 0) {
    vis[t] = 1;
    t = nxt[t];
  }
  bool f = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] && vis[n - i]) f = 1;
  }
  if (f)
    puts("Yes");
  else
    puts("No");
  return 0;
}
