#include <bits/stdc++.h>
int mod, n, x, y, good;
std::vector<int> f;
std::set<std::pair<int, int> > set;
inline void factorize() {
  f.push_back(1);
  for (int i = 2; i * i <= mod; i++)
    if (mod % i == 0) {
      f.push_back(i);
      if (i != mod / i) f.push_back(mod / i);
    }
}
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", &x, &y);
    set.insert(make_pair(x - 1, y - 1));
  }
  factorize();
  for (int k : f) {
    good = true;
    for (auto p : set)
      if (!set.count(make_pair((p.first + k) % mod, (p.second + k) % mod)))
        good = false;
    if (good) break;
  }
  printf("%s\n", good ? "Yes" : "No");
  return 0;
}
