#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long MOD = 1e9 + 7;
inline long long add(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
inline long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) x += mod;
  return x;
}
inline long long mul(long long x, long long y) { return (x * 1ll * y) % mod; }
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const long long N = 2e5 + 5;
vector<pair<long long, long long>> v;
long long l;
vector<bool> prime(N + 5, true);
vector<long long> pr;
void sieve() {
  for (long long i = 2; i <= N; i++) {
    if (prime[i]) {
      for (long long j = 2 * i; j <= N; j += i) {
        prime[j] = false;
      }
    }
  }
  for (long long i = 2; i <= N; i++) {
    if (prime[i]) {
      pr.push_back(i);
    }
  }
}
bool check(long long n) {
  vector<pair<long long, long long>> k;
  long long x, y;
  for (long long i = 0; i < v.size(); i++) {
    x = (v[i].first + n) % l, y = (v[i].second + n) % l;
    if (x > y) swap(x, y);
    k.push_back({x, y});
  }
  sort(k.begin(), k.end());
  if (k == v) return true;
  return false;
}
signed main() {
  {
    long long n, m;
    cin >> n >> m;
    long long x, y;
    l = n;
    for (long long i = 0; i < m; i++) {
      cin >> x >> y;
      x %= l, y %= l;
      if (x > y) swap(x, y);
      v.push_back({x, y});
    }
    sort(v.begin(), v.end());
    sieve();
    for (auto it : pr) {
      if (n % it == 0) {
        if (check(n / it)) return cout << "Yes", 0;
      }
    }
    cout << "NO";
  }
}
