#include <bits/stdc++.h>
using namespace std;
struct pair_hash {
  template <class T1, class T2>
  size_t operator()(pair<T1, T2> const &pair) const {
    size_t h1 = std::hash<T1>()(pair.first);
    size_t h2 = std::hash<T2>()(pair.second);
    return h1 ^ h2;
  }
};
unordered_set<pair<int, int>, pair_hash> segmentos;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<pair<int, int> > a(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i].first >> a[i].second;
    segmentos.insert({a[i].first, a[i].second});
  }
  for (int i = 1; i < n; i++) {
    if (n % i) continue;
    bool solved = true;
    for (int j = 0; j < m && solved; j++) {
      int optA = a[j].first;
      int optB = a[j].second;
      optA = (a[j].first + i > n ? 1 : 0) + (a[j].first + i) % (n + 1);
      optB = (a[j].second + i > n ? 1 : 0) + (a[j].second + i) % (n + 1);
      if (segmentos.find({optA, optB}) == segmentos.end() &&
          segmentos.find({optB, optA}) == segmentos.end()) {
        solved = false;
      }
    }
    if (solved) {
      printf("Yes");
      exit(0);
    }
  }
  printf("No");
  return 0;
}
