#include <bits/stdc++.h>
using namespace std;
int n, m;
set<pair<int, int> > s;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1, l, r; i <= m; i++) {
    scanf("%d %d", &l, &r);
    if ((r - l + n) % n > n / 2) {
      int p = l;
      l = r;
      r = p;
    }
    s.insert(make_pair(l % n, r % n));
    if (n % 2 == 0 && (r - l + n) % n == n / 2)
      s.insert(make_pair(r % n, l % n));
  }
  for (int p = 1; p * p <= n; p++) {
    if (n % p) continue;
    for (set<pair<int, int> >::iterator it = s.begin(); it != s.end(); it++)
      if (!s.count(make_pair((it->first + p) % n, (it->second + p) % n)))
        goto no1;
    goto yes;
  no1:
    if (p == 1 || p * p == n) continue;
    for (set<pair<int, int> >::iterator it = s.begin(); it != s.end(); it++)
      if (!s.count(
              make_pair((it->first + n / p) % n, (it->second + n / p) % n)))
        goto no2;
    goto yes;
  no2:;
  }
  puts("No");
  return 0;
yes:
  puts("Yes");
}
