#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> v;
set<int> g[100005];
vector<pair<int, int> > f;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      v.push_back(i);
      if (i * i != n && i != 1) v.push_back(n / i);
    }
  }
  int a, b;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    g[a].insert(a);
    g[b].insert(a);
    f.push_back(make_pair(a, b));
  }
  for (auto x : v) {
    bool flag = 1;
    for (auto y : f) {
      int l = y.first, r = y.second;
      l += x, r += x;
      if (l > n) l -= n;
      if (r > n) r -= n;
      if (g[l].count(r) || g[r].count(l))
        continue;
      else {
        flag = 0;
        break;
      }
    }
    if (flag) {
      cout << "Yes" << endl;
      exit(0);
    }
  }
  cout << "No";
}
