#include <bits/stdc++.h>
using namespace std;
int mult(int a, int b, int p = 1000000007) { return ((a % p) * (b % p)) % p; }
int multbig(int a, int b, int mod) {
  if (a == 0 or b == 0) return 0;
  if (a == 1 or b == 1) return (a * b) % mod;
  int cur = multbig(a, b / 2, mod);
  cur = (2 * cur) % mod;
  if (b % 2) cur = (cur + a) % mod;
  return cur;
}
int add(int a, int b, int p = 1000000007) { return (a % p + b % p) % p; }
int fpow(int n, int k, int p = 1000000007) {
  int r = 1;
  for (; k; k >>= 1LL) {
    if (k & 1LL) r = mult(r, n, p);
    n = mult(n, n, p);
  }
  return r;
}
int inv(int a, int p = 1000000007) { return fpow(a, p - 2, p); }
int inv_euclid(int a, int m = 1000000007) {
  int m0 = m;
  int y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    int q = a / m;
    int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
vector<pair<int, int>> vvv;
pair<int, int> aa[200003];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < (int)m; i++) {
    int p, q;
    cin >> p >> q;
    if (p > q) {
      swap(p, q);
    }
    aa[i].first = p;
    aa[i].second = q;
    vvv.push_back(make_pair(p, q));
  }
  sort(vvv.begin(), vvv.end());
  int f = 0;
  for (int i = 2; i <= n; i++) {
    if (n % i == 0) {
      int lol = n / i;
      vector<pair<int, int>> vv;
      for (int i = 0; i < (int)m; i++) {
        int p = aa[i].first + lol;
        int q = aa[i].second + lol;
        if (p > n) {
          p = p - n;
        }
        if (q > n) {
          q = q - n;
        }
        if (p > q) {
          swap(p, q);
        }
        vv.push_back(make_pair(p, q));
      }
      sort(vv.begin(), vv.end());
      if (vv == vvv) {
        f = 1;
        break;
      }
    }
  }
  if (f) {
    cout << "Yes\n";
  } else
    cout << "No\n";
}
