#include <bits/stdc++.h>
using namespace std;
int n, m;
struct ac {
  int x, y;
} t[202400];
bool cmp(const ac &a, const ac &b) {
  if (a.x != b.x) {
    return a.x < b.x;
  } else {
    return a.y < b.y;
  }
}
bool wfHas(int x, int y) {
  int l = 0, r = m - 1, mid;
  while (l < r) {
    mid = (l + r) / 2;
    if (t[mid].x == x && t[mid].y == y) {
      return true;
    }
    if (x < t[mid].x || x == t[mid].x && y < t[mid].y) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  return (t[l].x == x && t[l].y == y);
}
bool wf(int k) {
  int i, x, y;
  for (i = 0; i < m; i++) {
    x = t[i].x + k;
    y = t[i].y + k;
    if (x > n) x -= n;
    if (y > n) y -= n;
    if (x > y) {
      x ^= y;
      y ^= x;
      x ^= y;
    }
    if (!wfHas(x, y)) {
      return false;
    }
  }
  return true;
}
void solve() {
  int i, k;
  int x, y;
  for (i = 0; i < m; i++) {
    scanf("%d %d", &x, &y);
    if (x > y) {
      k = x;
      x = y;
      y = k;
    }
    t[i].x = x;
    t[i].y = y;
  }
  sort(t, t + m, cmp);
  if (wf(1)) {
    printf("Yes\n");
    return;
  }
  for (i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      if (wf(i) || wf(n / i)) {
        printf("Yes\n");
        return;
      }
    }
  }
  printf("No\n");
}
int main() {
  while (scanf("%d %d", &n, &m) != EOF) {
    solve();
  }
  return 0;
}
