#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
set<int> f[N];
bool tf1 = true;
inline int read() {
  int x = 0, k = 1;
  char c = getchar();
  for (; c < 48 || c > 57; c = getchar()) k ^= (c == '-');
  for (; c >= 48 && c <= 57; c = getchar()) x = x * 10 + (c ^ 48);
  return k ? x : -x;
}
int main() {
  int n = read(), m = read(), a, b;
  while (m--) a = read(), b = read(), f[--a].insert(--b), f[b].insert(a);
  for (int i = 1; i < n; i++)
    if (!(n % i)) {
      tf1 = true;
      for (int x = 0; x < n; x++)
        for (auto y : f[x]) tf1 &= f[(x + i) % n].count((y + i) % n);
      if (tf1) return printf("Yes\n"), 0;
    }
  printf("No\n");
  return 0;
}
