#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a[200005], b[200005], akar, k, x, y;
  bool valid;
  map<pair<int, int>, bool> ada;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &a[i], &b[i]);
    a[i]--;
    b[i]--;
    if (a[i] > b[i]) swap(a[i], b[i]);
    ada[make_pair(a[i], b[i])] = true;
  }
  akar = sqrt(n);
  for (int i = 1; i <= akar; i++)
    if (n % i == 0) {
      if (2 * i > n) break;
      k = i;
      valid = true;
      for (int j = 0; j < m; j++) {
        x = (a[j] + k) % n;
        y = (b[j] + k) % n;
        if (x > y) swap(x, y);
        if (ada.count(make_pair(x, y)) < 1) {
          valid = false;
          break;
        }
      }
      if (valid) {
        puts("Yes");
        return 0;
      }
      k = n / i;
      if ((k == i) || (2 * k > n)) continue;
      valid = true;
      for (int j = 0; j < m; j++) {
        x = (a[j] + k) % n;
        y = (b[j] + k) % n;
        if (x > y) swap(x, y);
        if (ada.count(make_pair(x, y)) < 1) {
          valid = false;
          break;
        }
      }
      if (valid) {
        puts("Yes");
        return 0;
      }
    }
  puts("No");
  return 0;
}
