#include <bits/stdc++.h>
using namespace std;
const int BUF = 1000000;
char buf[BUF], *p1, *p2;
inline char getChar() {
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  register int f = 0;
  register char c;
  while (!isdigit(c = getChar())) {
  }
  do f = f * 10 + (c ^ 48);
  while (isdigit(c = getChar()));
  return f;
}
const int N = 200003;
const long long yyb = 134874928973;
vector<int> g[N];
long long arr[N];
int fail[N];
int main() {
  int n = read(), m = read(), i, x, y;
  for (i = 1; i <= m; ++i) {
    x = read(), y = read();
    if (x > y) swap(x, y);
    g[x].push_back(y - x), g[y].push_back(x - y + n);
  }
  for (i = 1; i <= n; ++i) {
    sort(g[i].begin(), g[i].end());
    for (auto x : g[i]) arr[i] = (arr[i] * n + x) % yyb;
  }
  for (i = 1; i < n; ++i) arr[i + n] = arr[i];
  m = n << 1;
  bool ans = 0;
  for (i = 2, x = 0; i < m; ++i) {
    while (x && arr[i] != arr[x + 1]) x = fail[x];
    if (arr[i] == arr[x + 1]) ++x;
    fail[i] = x;
    if (x == n) {
      ans = 1;
      break;
    }
  }
  printf(ans ? "Yes" : "No");
  return 0;
}
