#include <bits/stdc++.h>
using namespace std;
set<pair<long long, long long>> sett;
long long n, m;
bool func(long long k) {
  set<pair<long long, long long>>::iterator it = sett.begin();
  while (it != sett.end()) {
    pair<long long, long long> o = (*it);
    o.first += k;
    o.second += k;
    o.first %= n;
    o.second %= n;
    long long f = o.first;
    long long ff = o.second;
    o.first = min(f, ff);
    o.second = max(f, ff);
    set<pair<long long, long long>>::iterator it1 = sett.find(o);
    if (it1 == sett.end()) {
      return 0;
    }
    it++;
  }
  return 1;
}
signed main() {
  cin >> n >> m;
  for (long long g = 0; g < m; g++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    pair<long long, long long> u;
    u.first = min(a, b);
    u.second = max(a, b);
    sett.insert(u);
  }
  for (long long i = 1; i < n; i++) {
    if (n % i == 0) {
      bool d = func(i);
      if (d == 1) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}
