#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, m;
vector<int> G[maxn];
bool check(int x) {
  for (int i = 0; i < n; ++i) {
    if (G[i] != G[(i + x) % n]) {
      return false;
    }
  }
  return true;
}
bool solve() {
  for (int i = 1; i < n; ++i) {
    if (n % i == 0) {
      if (check(i)) {
        return true;
      }
    }
  }
  return false;
}
int main() {
  while (~scanf("%d %d", &n, &m)) {
    for (int i = 0; i < n; ++i) {
      G[i].clear();
    }
    for (int i = 1, x, y; i <= m; ++i) {
      scanf("%d %d", &x, &y);
      if (x > y) swap(x, y);
      G[x - 1].push_back(y - x);
      G[y - 1].push_back(x + n - y);
    }
    for (int i = 0; i < n; ++i) {
      sort(G[i].begin(), G[i].end());
    }
    puts(solve() ? "Yes" : "No");
  }
  return 0;
}
