#include <bits/stdc++.h>
const int N = 2e5 + 10;
int mod, n, a, b, good;
std::pair<int, int> set[N];
std::pair<int, int> make_pair(int i, int j) {
  return {std::min(i, j), std::max(i, j)};
}
int main() {
  scanf("%d%d", &mod, &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    set[i] = make_pair(a - 1, b - 1);
  }
  std::sort(set, set + n);
  for (int k = 1; k < mod; k++) {
    if (mod % k) continue;
    good = true;
    for (int i = 0; i < n; i++)
      if (!std::binary_search(
              set, set + n,
              make_pair((set[i].first + k) % mod, (set[i].second + k) % mod))) {
        good = false;
        break;
      }
    if (good) {
      printf("yes\n");
      return 0;
    }
  }
  printf("no\n");
  return 0;
}
