#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  pair<int, int> b[m];
  map<pair<int, int>, int> d;
  int half = 0;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    half += abs(u - v) == n / 2;
    if (u > v) swap(u, v);
    if (n + u - v < v - u) swap(u, v);
    b[i].first = u, b[i].second = v;
    b[i].first--, b[i].second--;
    d[b[i]]++;
  }
  if (n % 2 == 0 && half == m) {
    cout << "Yes";
    return 0;
  }
  for (int i = 2; i * i <= n; i++) {
    if (n % i) continue;
    int j = i;
    bool cs = true;
    for (auto e : b) {
      if (d[make_pair((e.first + j) % n, (e.second + j) % n)] == 0) {
        cs = false;
        break;
      }
    }
    if (cs) {
      cout << "Yes";
      return 0;
    }
    j = n / i;
    cs = true;
    for (auto e : b) {
      if (d[make_pair((e.first + j) % n, (e.second + j) % n)] == 0) {
        cs = false;
        break;
      }
    }
    if (cs) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}
