#include <bits/stdc++.h>
using namespace std;
const int INF = 3e18;
const int MAXN = 2e5 + 228;
int n, m;
set<pair<int, int>> beg;
int nxt(int ind) {
  if (ind >= n) ind -= n;
  if (ind == 0) return n;
  return ind;
}
bool check(vector<int>& x, vector<int>& y, int add) {
  for (int i = 0; i < m; ++i) {
    int mn2 = nxt(x[i] + add), mx2 = nxt(y[i] + add);
    if (mn2 > mx2) swap(mn2, mx2);
    if (!beg.count({mn2, mx2})) {
      return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  vector<int> x(m), y(m);
  for (int i = 0; i < m; ++i) {
    cin >> x[i] >> y[i];
    if (x[i] > y[i]) {
      swap(x[i], y[i]);
    }
    beg.insert({x[i], y[i]});
  }
  for (int i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      if (check(x, y, i)) {
        cout << "Yes\n";
        return 0;
      }
      if (i != 1) {
        if (check(x, y, n / i)) {
          cout << "Yes\n";
          return 0;
        }
      }
    }
  }
  cout << "No\n";
  return 0;
}
