#include <bits/stdc++.h>
int mod, n, a, b, good;
std::set<std::pair<int, int> > set;
std::pair<int, int> make_pair(int i, int j) {
  return {std::min(i, j), std::max(i, j)};
}
int main() {
  scanf("%d%d", &mod, &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    set.insert(make_pair(a - 1, b - 1));
  }
  for (int k = 1; k < mod && !good; k++) {
    if (mod % k) continue;
    good = true;
    for (auto p = set.begin(); good && p != set.end(); p++)
      if (!set.count(make_pair((p->first + k) % mod, (p->second + k) % mod)))
        good = false;
  }
  printf("%s\n", good ? "Yes" : "No");
  return 0;
}
