#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
vector<int> fac;
vector<int> vex[MAXN];
int n, m;
void split(int n) {
  int cnt = sqrt(n) + 1;
  fac.push_back(1);
  for (int i = 2; i < cnt; i++) {
    if (n % i == 0) fac.push_back(i), fac.push_back(n / i);
  }
  sort(fac.rbegin(), fac.rend());
}
bool check(int d) {
  int ops = 1;
  int cnt = n / d;
  for (int i = 1; i < cnt; i++) {
    for (int j = 0; j < d; j++) {
      if (vex[ops + j].size() != vex[ops + j + i * d].size()) return false;
      for (int k = 0; k < vex[ops + j].size(); k++) {
        if (vex[ops + j][k] != vex[ops + j + i * d][k]) return false;
      }
    }
  }
  return true;
}
int main() {
  cin >> n >> m;
  int begin, end;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &begin, &end);
    vex[begin].push_back(((end - begin) % n + n) % n);
    vex[end].push_back(((begin - end) % n + n) % n);
  }
  for (int i = 1; i <= n; i++) {
    sort(vex[i].begin(), vex[i].end());
  }
  split(n);
  for (int i = 0; i < fac.size(); i++) {
    int guess = fac[i];
    if (check(guess)) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
}
