#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > diff;
  map<pair<int, int>, int> mm;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    mm[make_pair(x, y)] = 1;
    diff.push_back(make_pair(x, y));
  }
  int u = 0;
  for (int i = 1; i < n; i++) {
    if (n % i == 0) {
      int j = 0;
      for (j = 0; j < m; j++) {
        int x = diff[j].first, y = diff[j].second;
        x += i;
        y += i;
        if (x > n) x %= n;
        if (y > n) y %= n;
        if (!((mm).find(make_pair(x, y)) != (mm).end()) &&
            !((mm).find(make_pair(y, x)) != (mm).end()))
          break;
      }
      if (j == m) {
        u = 1;
        break;
      }
    }
  }
  if (u)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
