#include <bits/stdc++.h>
using namespace std;
struct triplet {
  int index, a, b;
};
bool comp(triplet &t1, triplet &t2) { return (t1.a < t2.a); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, a, b;
  cin >> n >> m;
  vector<pair<long long int, long long int> > v1, v2;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    v1.push_back({min(a, b), max(a, b)});
  }
  sort(v1.begin(), v1.end());
  for (int j = 0; j < m; j++) {
    a = v1[j].first;
    b = v1[j].second;
    a = a + 1;
    b = b + 1;
    if (a > n) a = a - n;
    if (b > n) b = b - n;
    v2.push_back({min(a, b), max(a, b)});
  }
  sort(v2.begin(), v2.end());
  if (v2 == v1) {
    cout << "Yes";
    return 0;
  }
  for (int i = 2; i * i <= n; i++) {
    if ((n % i) != 0) continue;
    v2.clear();
    for (int j = 0; j < m; j++) {
      a = v1[j].first;
      b = v1[j].second;
      a = a + i;
      b = b + i;
      if (a > n) a = a - n;
      if (b > n) b = b - n;
      v2.push_back({min(a, b), max(a, b)});
    }
    sort(v2.begin(), v2.end());
    if (v2 == v1) {
      cout << "Yes";
      return 0;
    }
    v2.clear();
    for (int j = 0; j < m; j++) {
      a = v1[j].first;
      b = v1[j].second;
      a = a + n / i;
      b = b + n / i;
      if (a > n) a = a - n;
      if (b > n) b = b - n;
      v2.push_back({min(a, b), max(a, b)});
    }
    sort(v2.begin(), v2.end());
    if (v2 == v1) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}
