#include <bits/stdc++.h>
using namespace std;
;
const int BufferSize = 1 << 16;
char buffer[BufferSize], *head, *tail;
inline char Getchar() {
  if (head == tail) {
    int l = fread(buffer, 1, BufferSize, stdin);
    tail = (head = buffer) + l;
  }
  return *head++;
}
inline int read() {
  int x = 0, f = 1;
  char c = Getchar();
  for (; !isdigit(c); c = Getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = Getchar()) x = x * 10 + c - '0';
  return x * f;
}
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int maxn = 3e5 + 5;
const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3f;
pair<int, int> que[maxn];
int num[maxn];
map<int, map<int, int> > mp;
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, l, r, len;
  cin >> n >> m;
  if (n == 2) return cout << "YES" << endl, 0;
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    len = min((r - l + n) % n, n - (r - l + n) % n);
    mp[l][r] = mp[r][l] = 1;
    num[len]++;
    que[i] = pair<int, int>(l, r);
  }
  for (int i = 1; i * i <= num[len]; i++) {
    if (num[len] % i == 0) {
      if (i != 1 && n % i == 0) {
        int flag = 0, d = n / i;
        for (int j = 0; j < m; j++) {
          int l = que[j].first, r = que[j].second, ld = l + d, rd = r + d;
          if (ld > n) ld -= n;
          if (rd > n) rd -= n;
          if (mp[ld].find(rd) == mp[ld].end()) {
            flag = 1;
            break;
          }
        }
        if (!flag) return cout << "Yes" << endl, 0;
      }
      if (num[len] / i != 1 && n % (num[len] / i) == 0) {
        int flag = 0, d = n / (num[len] / i);
        for (int j = 0; j < m; j++) {
          int l = que[j].first, r = que[j].second, ld = l + d, rd = r + d;
          if (ld > n) ld -= n;
          if (rd > n) rd -= n;
          if (mp[ld].find(rd) == mp[ld].end()) {
            flag = 1;
            break;
          }
        }
        if (!flag) return cout << "Yes" << endl, 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}
