#include <bits/stdc++.h>
using namespace std;
int thing(int a, int b, int n) { return ((b - a) % n + n) % n; }
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<set<int>> gr(n);
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    gr[a].insert(thing(a, b, n));
    gr[b].insert(thing(b, a, n));
  }
  vector<int> fact = {1};
  for (int i = 2; i * i <= n; ++i) {
    if (n % i) continue;
    fact.push_back(i);
    if (i * i < n) fact.push_back(n / i);
  }
  for (auto &i : fact) {
    bool ok = 1;
    for (int j = 0; j < n; ++j)
      if (gr[j] != gr[(j + i) % n]) {
        ok = 0;
        break;
      }
    if (ok) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
}
