#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  cin >> n >> m;
  vector<int> d;
  map<pair<int, int>, int> dic;
  for (int i = 1; i * i <= n; i++) {
    if (!(n % i)) {
      d.push_back(i);
      d.push_back(n / i);
    }
  }
  sort(d.begin(), d.end());
  int x, y;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    if (x > y) swap(x, y);
    dic[{x, y}]++;
  }
  for (int x : d) {
    if (x == n) break;
    bool ok = true;
    for (auto i : dic) {
      pair<int, int> j = make_pair((i.first.first + x - 1) % n + 1,
                                   (i.first.second + x - 1) % n + 1);
      if (j.first > j.second) swap(j.first, j.second);
      if (!dic.count(j)) {
        ok = false;
        break;
      }
    }
    if (ok) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}
