#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr double kPI = 3.14159265358979323846264338327950288;
vector<ll> GetAllDivisorsUnsorted(ll a) {
  vector<ll> divs;
  for (ll i = 1; i * i <= a; ++i) {
    if (a % i == 0) {
      divs.push_back(i);
      if (i != a / i) divs.push_back(a / i);
    }
  }
  return divs;
}
int n, m;
vector<int> a, b;
set<pair<int, int>> segs;
void Load() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--, b--;
    segs.insert({a, b});
    segs.insert({b, a});
  }
}
bool RotateWorks(ll div) {
  for (const auto& seg : segs) {
    if (segs.count({(seg.first + div) % n, (seg.second + div) % n}) == 0)
      return false;
  }
  return true;
}
void Solve() {
  vector<ll> divs = GetAllDivisorsUnsorted(n);
  for (ll div : divs) {
    if (div == n) continue;
    if (RotateWorks(div)) {
      puts("Yes");
      return;
    }
  }
  puts("No");
}
int main() {
  Load();
  Solve();
}
