#include <bits/stdc++.h>
using namespace std;
int degree[100005];
struct point {
  int x, y, id;
} ar[200005];
int N, M;
void merge(point ar[], int l, int m, int r) {
  int i = l, j = m + 1, k = 0;
  point tmp[r - l + 1];
  while (i <= m && j <= r) {
    if (ar[j].x < ar[i].x)
      tmp[k] = ar[j], j++, k++;
    else
      tmp[k] = ar[i], i++, k++;
  }
  while (i <= m) tmp[k] = ar[i], i++, k++;
  while (j <= r) tmp[k] = ar[j], j++, k++;
  for (i = l; i <= r; i++) ar[i] = tmp[i - l];
}
void mergeSort(point ar[], int l, int r) {
  if (l < r) {
    int m = (l + r) / 2;
    mergeSort(ar, l, m);
    mergeSort(ar, m + 1, r);
    merge(ar, l, m, r);
  }
}
void structure_sort() { mergeSort(ar, 1, M); }
int main() {
  int a, b;
  int i, j, k, l;
  cin >> N >> M;
  for (i = 1; i <= M; i++) {
    scanf("%d%d", &a, &b);
    degree[a]++, degree[b]++;
    if (a <= b)
      ar[i].x = a, ar[i].y = b;
    else
      ar[i].x = b, ar[i].y = a;
    ar[i].id = i;
  }
  structure_sort();
  bool flg;
  int cnt = 0, sz = 0, div[100005];
  for (i = 1; i * i <= N; i++) {
    if (N % i == 0) div[sz++] = i, div[sz++] = N / i;
  }
  for (l = 0; l < sz; l++) {
    k = div[l];
    if (k == N) continue;
    cnt = 0;
    for (i = 1; i <= M; i++) {
      a = ar[i].x + k, b = ar[i].y + k;
      if (a > N) a %= N;
      if (b > N) b %= N;
      if (a > b) j = a, a = b, b = j;
      flg = 0;
      int low = 1, high = M, mid;
      while (low <= high) {
        mid = (low + high) / 2;
        if (a < ar[mid].x)
          high = mid - 1;
        else if (a > ar[mid].x) {
          low = mid + 1;
        } else {
          for (j = mid; j >= 1; j--) {
            if (a != ar[j].x) break;
            if (ar[j].x == a && ar[j].y == b) {
              cnt++;
              flg = 1;
              break;
            }
          }
          if (!flg) {
            for (j = mid + 1; j <= M; j++) {
              if (a != ar[j].x) break;
              if (ar[j].x == a && ar[j].y == b) {
                cnt++;
                flg = 1;
                break;
              }
            }
          }
          flg = 1;
        }
        if (flg) break;
      }
      if (!flg) break;
    }
    if (cnt == M) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
