#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> seg(m);
  vector<set<int>> was(n + 1);
  for (int i = 0; i < m; ++i) {
    cin >> seg[i].first >> seg[i].second;
    if (seg[i].first > seg[i].second) {
      swap(seg[i].first, seg[i].second);
    }
    was[seg[i].first].insert(seg[i].second);
  }
  auto check = [&](int k) {
    int cnt = 0;
    for (int i = 0; i < m; ++i) {
      int l = seg[i].first + k, r = seg[i].second + k;
      if (l > n) {
        l -= n;
      }
      if (r > n) {
        r -= n;
      }
      if (l > r) {
        swap(l, r);
      }
      cnt += (was[l].find(r) != was[l].end());
    }
    return cnt == m;
  };
  for (int k = 1; k * k <= n; ++k) {
    if (k == 1) {
      if (check(1)) {
        cout << "Yes";
        return 0;
      }
    } else if (n % k == 0) {
      if (check(k)) {
        cout << "Yes";
        return 0;
      } else if (check(n / k)) {
        cout << "Yes";
        return 0;
      }
    }
  }
  cout << "No";
  return 0;
}
