#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > segs;
vector<int> listaDivisores;
int main() {
  int n, m;
  cin >> n >> m;
  int a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    segs.insert(make_pair(a, b));
  }
  for (int i = 1; i * i <= n; i++)
    if (n % i == 0) {
      listaDivisores.push_back(i);
      if (i * i != n && i != 1) listaDivisores.push_back(n / i);
    }
  bool res;
  for (auto x : listaDivisores) {
    res = true;
    for (auto s : segs) {
      int ini = s.first + x;
      int end = s.second + x;
      if (ini > n) ini = (ini % (n + 1)) + 1;
      if (end > n) end = (end % (n + 1)) + 1;
      if (segs.find(make_pair(ini, end)) == segs.end() &&
          segs.find(make_pair(end, ini)) == segs.end())
        res = false;
      if (!res) break;
    }
    if (res) break;
  }
  if (res)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
