#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 5;
const int inf = 1e9 + 5;
const int mod = 1e9 + 7;
vector<int> v[M];
int hx2[2 * M];
int hx[M];
int nxt[M];
int n, m;
int KMP() {
  memset(nxt, 0, sizeof(nxt));
  int la, lb;
  la = n;
  lb = m;
  int j, k;
  j = 0;
  k = -1;
  nxt[0] = -1;
  while (j < la) {
    if (k == -1 || hx[j] == hx[k]) {
      j++;
      k++;
      nxt[j] = k;
    } else {
      k = nxt[k];
    }
  }
  int ans = 0;
  j = 0;
  k = 0;
  while (k < lb) {
    if (j == -1 || hx[j] == hx2[k]) {
      j++;
      k++;
    } else {
      j = nxt[j];
    }
    if (j == la) {
      j = nxt[j];
      ans++;
    }
  }
  return ans;
}
int main() {
  int k;
  scanf("%d%d", &n, &k);
  m = 2 * n;
  for (int i = 0; i < k; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    v[a].push_back(min(b - a, n - b + a));
    v[b].push_back(min(b - a, n - b + a));
  }
  for (int i = 0; i < n; i++) {
    sort(v[i + 1].begin(), v[i + 1].end());
    for (int j = 0; j < v[i + 1].size(); j++) {
      hx[i] = hx[i] * n + v[i + 1][j];
    }
  }
  for (int i = 0; i < n; i++) {
    hx2[i] = hx[i];
    hx2[i + n] = hx[i];
  }
  if (KMP() <= 2) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }
  return 0;
}
