#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long min(long long a, long long b) { return a + b - max(a, b); }
long long mulmod(long long a, long long b, long long mod) {
  return ((a % 1000000007) * (b % 1000000007) % 1000000007);
}
long long mod(long long a, long long b) {
  if (a > b)
    return a - b;
  else
    return b - a;
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, m;
  cin >> n >> m;
  vector<pair<long long, long long> > vec(m);
  clock_t start, end;
  start = clock();
  for (long long i = 0; i < m; i++) {
    cin >> vec[i].first >> vec[i].second;
    long long a = min(vec[i].first, vec[i].second);
    long long b = max(vec[i].first, vec[i].second);
    vec[i].first = a;
    vec[i].second = b;
  }
  sort(vec.begin(), vec.end());
  for (long long i = 2; i <= n; i++) {
    end = clock();
    double time_taken = double(end - start) / double(CLOCKS_PER_SEC);
    if (time_taken > 2.5) {
      cout << "NO";
      return 0;
    }
    if (n % i == 0) {
      long long k = n / i, a, b;
      vector<pair<long long, long long> > vec1;
      for (auto it : vec) {
        if ((it.first + k) == n)
          a = n;
        else
          a = (it.first + k) % n;
        if ((it.second + k) == n)
          b = n;
        else
          b = (it.second + k) % n;
        vec1.push_back({min(a, b), max(a, b)});
      }
      sort(vec1.begin(), vec1.end());
      bool flag = false;
      for (long long j = 0; j < m; j++) {
        if (vec[j].first != vec1[j].first || vec[j].second != vec1[j].second) {
          flag = true;
        }
      }
      if (!flag) {
        cout << "YES\n";
        return 0;
      }
    }
  }
  cout << "NO";
}
