#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> divs;
pair<int, int> segs[200010];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      divs.push_back(i);
      if (i != 1) divs.push_back(n / i);
    }
  }
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &segs[i].first, &segs[i].second);
    segs[i].first %= n;
    segs[i].second %= n;
    if (segs[i].first > segs[i].second) swap(segs[i].first, segs[i].second);
  }
  sort(segs, segs + m);
  int s = (int)divs.size();
  for (int i = 0; i < s; i++) {
    pair<int, int> new_segs[200010];
    for (int j = 0; j < m; j++) {
      new_segs[j] = make_pair((segs[j].first + divs[i]) % n,
                              (segs[j].second + divs[i]) % n);
      if (new_segs[j].first > new_segs[j].second)
        swap(new_segs[j].first, new_segs[j].second);
    }
    sort(new_segs, new_segs + m);
    bool poss = true;
    for (int j = 0; j < m; j++) {
      if (new_segs[j] != segs[j]) {
        poss = false;
        break;
      }
    }
    if (poss) {
      printf("Yes\n");
      return 0;
    }
    for (int j = 0; j < m; j++) {
      new_segs[j] = make_pair((segs[j].first + n - divs[i]) % n,
                              (segs[j].second + n - divs[i]) % n);
      if (new_segs[j].first > new_segs[j].second)
        swap(new_segs[j].first, new_segs[j].second);
    }
    sort(new_segs, new_segs + m);
    poss = true;
    for (int j = 0; j < m; j++) {
      if (new_segs[j] != segs[j]) {
        poss = false;
        break;
      }
    }
    if (poss) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}
