#include <bits/stdc++.h>
using namespace std;
vector<int> divs(int n) {
  vector<int> d;
  for (int i = 1; i < n; i++) {
    if (n % i == 0) d.push_back(i);
  }
  return d;
}
bool check(set<pair<int, int> > &seg, int d, int n) {
  for (auto s : seg) {
    if (seg.find({(s.first + d) % n, (s.second + d) % n}) == seg.end() &&
        seg.find({(s.second + d) % n, (s.first + d) % n}) == seg.end())
      return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  set<pair<int, int> > segments;
  for (__typeof(0) i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    segments.insert(make_pair(x - 1, y - 1));
  }
  vector<int> ds = divs(n);
  for (auto d : ds) {
    if (check(segments, d, n)) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}
