#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  int fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= fh;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
int n, m;
int p[200005];
int ne[100005];
signed main() {
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    if (b - a < n - (b - a)) {
      p[a]++;
      p[b + 1]--;
    } else if (b - a > n - (b - a)) {
      p[b]++;
      p[1]++;
      p[a + 1]--;
    } else {
      p[a]++;
      p[a + 2]--;
      p[b]++;
      if (b == n)
        p[1]++, p[2]--;
      else
        p[b + 2]--;
    }
  }
  for (int i = 1; i <= n; ++i) {
    p[i] += p[i - 1];
    p[i + n] = p[i];
  }
  for (int i = 2, j = 0; i <= n; ++i) {
    while (j && p[j + 1] != p[i]) j = ne[j];
    if (p[j + 1] == p[i]) j++;
    ne[i] = j;
  }
  for (int i = 1, j = 0; i <= 2 * n - 1; ++i) {
    while (j && p[j + 1] != p[i]) j = ne[j];
    if (p[j + 1] == p[i]) j++;
    if (j == n) {
      if (i != n) {
        cout << "Yes" << endl;
        return 0;
      }
      j = ne[j];
    }
  }
  cout << "No" << endl;
  return 0;
}
