#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long f = 1, x = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int MAXN = 2e5 + 5;
int n, m;
map<pair<int, int>, bool> mp;
pair<int, int> p[MAXN];
bool check(int k) {
  if (k >= n) return false;
  for (int i = 1; i <= m; ++i) {
    pair<int, int> t;
    t.first = p[i].first + k;
    t.second = p[i].second + k;
    if (t.first > n) t.first -= n;
    if (t.second > n) t.second -= n;
    if (t.first > t.second) swap(t.first, t.second);
    if (mp.find(t) == mp.end()) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  n = read();
  m = read();
  for (int i = 1; i <= m; ++i) {
    p[i].first = read();
    p[i].second = read();
    if (p[i].first > p[i].second) swap(p[i].first, p[i].second);
    mp[p[i]] = 1;
  }
  for (int i = 1; i * i <= n; ++i) {
    if (n % i) continue;
    if (check(i)) {
      cout << "Yes" << endl;
      return 0;
    }
    if (check(n / i)) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
