#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5, mod = 998244353;
int n, m;
set<pair<int, int> > mds;
int check(int x, int ff) {
  int nxt;
  if (ff != 1) {
    for (set<pair<int, int> >::iterator it = mds.begin(); it != mds.end();
         it++) {
      nxt = (it->first + x) % (2 * n);
      if (mds.find(make_pair(nxt, it->second)) == mds.end()) return 0;
    }
    return 1;
  } else {
    for (set<pair<int, int> >::iterator it = mds.begin(); it != mds.end();
         it++) {
      nxt = (it->first + x) % (2 * n);
      if (mds.find(make_pair(nxt, it->second)) == mds.end() &&
          mds.find(make_pair(nxt % n, it->second)) == mds.end())
        return 0;
    }
    return 1;
  }
}
vector<int> cnt[400000 + 50];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  int u, v, mid, dif, mdf = 0;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    u--, v--;
    if (abs(u - v) > n - (abs(u - v))) {
      dif = n - (abs(u - v));
      mid = (u + v + n);
      if (mid >= 2 * n) mid -= 2 * n;
    } else {
      dif = abs(u - v);
      mid = (u + v);
    }
    mds.insert(make_pair(mid, dif));
    cnt[dif].push_back(mid);
    mdf = max(mdf, dif);
  }
  int flag = 0;
  for (int i = 1; i <= mdf; i++) {
    if (cnt[i].size() != 0) {
      if (2 * i == n) {
        flag = check(n, 1);
      } else {
        int cc = cnt[i].size();
        for (int j = 1; j * j <= cc; j++) {
          if (cc % j == 0) {
            if (cc != j * j) {
              if (n % j == 0 && j != 1) flag = max(flag, check(2 * (n / j), 0));
              if (n % (cc / j) == 0)
                flag = max(flag, check(2 * (n / (cc / j)), 0));
            } else {
              flag = max(flag, check(2 * j, 0));
            }
          }
        }
      }
      break;
    }
  }
  if (flag) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
