#include <bits/stdc++.h>
using namespace std;
int n, m;
map<pair<int, int>, bool> f;
map<pair<int, int>, bool> f1;
vector<int> divs;
pair<int, int> v[200001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> v[i].first >> v[i].second;
    if (v[i].first > v[i].second) swap(v[i].first, v[i].second);
    f[v[i]] = 1;
  }
  for (int d = 1; d < n; d++)
    if (n % d == 0) divs.push_back(d);
  for (auto val : divs) {
    bool ok = 1;
    for (int i = 1; i <= m; i++) {
      pair<int, int> p = v[i];
      p.first += val;
      if (p.first > n) p.first -= n;
      p.second += val;
      if (p.second > n) p.second -= n;
      if (p.first > p.second) swap(p.first, p.second);
      if (f.count(p) == 0) {
        ok = 0;
        break;
      }
    }
    if (ok) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}
