#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 50;
const int inf = 1e9;
int n, m;
vector<int> a[maxn];
bool check(int p) {
  if (p == n) return false;
  for (int i = 1; i < n / p; ++i) {
    for (int j = 1; j <= p; ++j) {
      int now = i * p + j;
      int len1 = a[now].size();
      int len2 = a[now - p].size();
      if (len1 != len2) return false;
      for (int k = 0; k < len1; ++k)
        if (a[now][k] != a[now - p][k]) return false;
    }
  }
  return true;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x > y) swap(x, y);
    if (y - x <= x + n - y) a[x].push_back(y - x);
    if (y - x >= x + n - y) a[y].push_back(x + n - y);
  }
  for (int i = 1; i <= n; ++i) sort(a[i].begin(), a[i].end());
  int p = sqrt(n + 0.5);
  bool flag = false;
  for (int i = 1; i <= p; ++i) {
    if (n % i == 0) {
      if (check(i) || check(n / i)) flag = true;
    }
  }
  if (flag)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
