#include <bits/stdc++.h>
using namespace std;
int main() {
  long long xx, yy, n, m, i, g, j, k, x, y;
  std::vector<long long> v;
  vector<pair<long long, long long>> vp;
  cin >> n >> m;
  map<pair<long long, long long>, long long> mp;
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    vp.push_back({x, y});
    mp[{x, y}]++;
  }
  for (i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      v.push_back(i);
      v.push_back(n / i);
    }
    if ((n % i == 0 && i == n / i) || i == 1) {
      v.pop_back();
    }
  }
  for (auto itr : v) {
    g = 1;
    k = itr;
    for (i = 0; i < m; i++) {
      xx = vp[i].first + k;
      yy = vp[i].second + k;
      if (xx >= n + 1) {
        xx = xx % (n + 1) + 1;
      }
      if (yy >= n + 1) {
        yy = yy % (n + 1) + 1;
      }
      if (mp.find({xx, yy}) == mp.end() && mp.find({yy, xx}) == mp.end()) {
        g = 0;
        break;
      }
    }
    if (g) {
      cout << "Yes"
           << "\n";
      return 0;
    }
  }
  cout << "No"
       << "\n";
  return 0;
}
