#include <bits/stdc++.h>
using namespace std;
template <class t>
inline t read(t &x) {
  char c = getchar();
  bool f = 0;
  x = 0;
  while (!isdigit(c)) f |= c == '-', c = getchar();
  while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  if (f) x = -x;
  return x;
}
template <class t, class... A>
inline void read(t &x, A &...a) {
  read(x);
  read(a...);
}
template <class t>
inline void write(t x) {
  if (x < 0)
    putchar('-'), write(-x);
  else {
    if (x > 9) write(x / 10);
    putchar('0' + x % 10);
  }
}
const int N = 2e5 + 5, mod = 1e9 + 7;
vector<int> g[N];
int n, h[N], m;
bool check(int d) {
  for (int i = 0; i < n; i++)
    if (h[i] != h[(i + d) % n]) return 0;
  return 1;
}
int calc(vector<int> &g) {
  int res = 0;
  for (int x : g) res = (res * 233ll + x) % mod;
  return res;
}
signed main() {
  read(n, m);
  for (int i = 1, x, y; i <= m; i++) {
    read(x, y);
    x--;
    y--;
    if (x > y) swap(x, y);
    g[x].push_back(y - x);
    g[y].push_back(n - y + x);
  }
  for (int i = 0; i < n; i++)
    sort((g[i]).begin(), (g[i]).end()), h[i] = calc(g[i]);
  for (int d = 1; d <= n / 2; d++)
    if (n % d == 0)
      if (check(d)) return puts("Yes");
  puts("No");
}
