#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<pair<int, int> > v;
bool check(int k) {
  if (k == n) return 0;
  vector<pair<int, int> > cur;
  for (int i = 0; i < m; i++) {
    pair<int, int> p;
    p = v[i];
    p.first = (p.first + k) % n;
    p.second = (p.second + k) % n;
    if (p.first > p.second) swap(p.first, p.second);
    cur.push_back(p);
  }
  sort(cur.begin(), cur.end());
  return (cur == v);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int i, x, y;
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    x--;
    y--;
    if (x > y) swap(x, y);
    v.push_back(make_pair(x, y));
  }
  sort(v.begin(), v.end());
  for (i = 1; i * i <= n; i++) {
    if (n % i == 0 && (check(i) || check(n / i))) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}
