#include <bits/stdc++.h>
using namespace std;
int GCD(int a, int b) {
  if (b == 0) return a;
  return GCD(b, a % b);
}
int main() {
  int n, m, i, j, u, v;
  cin >> n >> m;
  vector<vector<int> > cnt(n + 1);
  vector<set<int> > At_this(n + 1);
  for (i = 0; i < m; i++) {
    cin >> u >> v;
    if (v > u) {
      j = v;
      v = u;
      u = j;
    }
    j = u - v;
    cnt[j].push_back(v);
    cnt[n - j].push_back(u);
    At_this[v].insert(j);
    At_this[u].insert(n - j);
  }
  int GG = n;
  for (i = 1; i <= n; i++) {
    if (cnt[i].size() > 0) {
      j = GCD(n, (int)cnt[i].size());
      GG = GCD(GG, j);
    }
  }
  GG = n / GG;
  int flag = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j < cnt[i].size(); j++) {
      u = cnt[i][j];
      u = (u + GG);
      if (u > n) u -= n;
      if (At_this[u].find(i) == At_this[u].end()) {
        flag = 0;
      }
    }
  }
  if (GG == n)
    cout << "No" << endl;
  else {
    if (flag)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
