#include <bits/stdc++.h>
using namespace std;
map<pair<long long int, long long int>, long long int> m1;
bool check(long long int k, long long int n) {
  long long int cnt = 0;
  for (auto it = m1.begin(); it != m1.end(); it++) {
    long long int x = ((it->first).first + k) % n;
    long long int y = ((it->first).second + k) % n;
    if (x > y) swap(x, y);
    pair<long long int, long long int> p = {x, y};
    if (m1.find(p) != m1.end()) cnt++;
  }
  if (cnt == m1.size()) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  vector<long long int> fac;
  for (long long int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      fac.push_back(i);
      fac.push_back(n / i);
    }
    if (i * i == n) fac.pop_back();
  }
  sort(fac.begin(), fac.end());
  fac.pop_back();
  for (long long int i = 0; i < m; i++) {
    long long int x, y;
    cin >> x >> y;
    x--, y--;
    if (x > y) swap(x, y);
    m1[{x, y}]++;
  }
  for (long long int i = 0; i < fac.size(); i++) {
    if (check(fac[i], n)) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}
