#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long exp(long long a, long long b, long long m) {
  if (b == 0) return 1;
  if (b == 1) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
vector<long long> factorize(long long n) {
  vector<long long> factors(1);
  factors[0] = 1;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      factors.push_back(i);
      if (i != n / i) factors.push_back(n / i);
    }
  }
  return factors;
}
int32_t main() {
  long long n, m;
  cin >> n >> m;
  set<pair<long long, long long> > seg;
  long long mov = 0;
  long long a, b;
  for (long long i = 0; i < m; i++) {
    cin >> a >> b;
    if (b < a) {
      swap(b, a);
    }
    b--;
    a--;
    seg.insert(pair<long long, long long>(a, b));
  }
  vector<long long> f = factorize(n);
  bool ok = false;
  for (long long x : f) {
    ok = true;
    for (pair<long long, long long> y : seg) {
      pair<long long, long long> now =
          pair<long long, long long>(mod(y.first + x, n), mod(y.second + x, n));
      if (now.first > now.second) swap(now.first, now.second);
      if (!seg.count(now)) {
        ok = false;
        break;
      }
    }
    if (ok) break;
  }
  cout << (ok ? "yes" : "no") << "\n";
}
