#include <bits/stdc++.h>
using namespace std;
int st[200005], ed[200005];
set<int> v[100005];
int main() {
  int n, m;
  int x, y;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &x, &y);
    if (x > y) swap(x, y);
    v[x].insert(y);
    st[i] = x;
    ed[i] = y;
  }
  for (int i = 0; i < m; ++i) {
    x = st[i];
    y = ed[i];
    x++;
    y++;
    if (x > n) x -= n;
    if (y > n) y -= n;
    if (x > y) swap(x, y);
    if (!v[x].count(y)) {
      break;
    }
    if (i == m - 1) {
      cout << "Yes" << endl;
      exit(0);
    }
  }
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      for (int j = 0; j < m; ++j) {
        x = st[j];
        y = ed[j];
        x += i;
        y += i;
        if (x > n) x -= n;
        if (y > n) y -= n;
        if (x > y) swap(x, y);
        if (!v[x].count(y)) {
          break;
        }
        if (j == m - 1) {
          cout << "Yes" << endl;
          exit(0);
        }
      }
      for (int j = 0; j < m; ++j) {
        x = st[j];
        y = ed[j];
        x += n / i;
        y += n / i;
        if (x > n) x -= n;
        if (y > n) y -= n;
        if (x > y) swap(x, y);
        if (!v[x].count(y)) {
          break;
        }
        if (j == m - 1) {
          cout << "Yes" << endl;
          exit(0);
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}
