#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l, int r) { return l + rng() % (r - l + 1); }
const int N = 1011;
int n, m;
int p[N];
vector<pair<int, int> > q;
vector<pair<int, int> > st;
pair<int, int> shift(pair<int, int> &x, int d) {
  pair<int, int> y = {(x.first + d) % n, (x.second + d) % n};
  if (y.first > y.second) swap(y.first, y.second);
  return y;
}
void solve(int d) {
  if (d == n) return;
  vector<pair<int, int> > ed;
  for (auto &x : q) ed.push_back(shift(x, d));
  sort(ed.begin(), ed.end());
  if (st != ed) return;
  cout << "Yes";
  exit(0);
}
int main() {
  n = ({
    int x = 0;
    int c = getchar(), n = 0;
    for (; !isdigit(c); c = getchar()) n = (c == '-');
    for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
    n ? -x : x;
  }),
  m = ({
    int x = 0;
    int c = getchar(), n = 0;
    for (; !isdigit(c); c = getchar()) n = (c == '-');
    for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
    n ? -x : x;
  });
  for (int i = 1, _c = m; i <= _c; ++i) {
    int a = ({
      int x = 0;
      int c = getchar(), n = 0;
      for (; !isdigit(c); c = getchar()) n = (c == '-');
      for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
      n ? -x : x;
    }),
        b = ({
          int x = 0;
          int c = getchar(), n = 0;
          for (; !isdigit(c); c = getchar()) n = (c == '-');
          for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
          n ? -x : x;
        });
    a--, b--;
    if (a > b) swap(a, b);
    q.push_back({a, b});
    st.push_back({a, b});
  }
  sort(st.begin(), st.end());
  for (int i = 1, _c = sqrt(n); i <= _c; ++i)
    if (n % i == 0) solve(i), solve(n / i);
  cout << "No";
}
