#include <bits/stdc++.h>
const int N = 2e5 + 10;
int mod, n;
std::pair<int, int> arr[N];
std::set<std::pair<int, int> > set;
std::set<int> kset;
std::vector<int> f;
void factorize() {
  for (int i = 1; i < mod; i++)
    if (mod % i == 0) f.push_back(i);
}
int main() {
  scanf("%d%d", &mod, &n);
  if (n == 1) {
    printf("Yes\n");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &arr[i].first, &arr[i].second);
    arr[i].first--;
    arr[i].second--;
    if (arr[i].first > arr[i].second) std::swap(arr[i].first, arr[i].second);
    set.insert(arr[i]);
  }
  factorize();
  for (int i = 0; i < n; i++) {
    std::set<int> tmp;
    for (int k : f) {
      std::pair<int, int> other = {(arr[i].first + k) % mod,
                                   (arr[i].second + k) % mod};
      if (other.first > other.second) std::swap(other.first, other.second);
      if (set.count(other)) tmp.insert(k);
    }
    if (i == 0) {
      for (int k : tmp) kset.insert(k);
    } else {
      for (auto it = kset.begin(); it != kset.end();) {
        if (tmp.count(*it))
          it++;
        else
          it = kset.erase(it);
      }
    }
    if (kset.empty()) break;
  }
  printf("%s\n", kset.empty() ? "No" : "Yes");
  return 0;
}
