#include <bits/stdc++.h>
using namespace std;
bool shift(set<pair<int, int>> se, int p, int n) {
  set<pair<int, int>> new_s;
  for (auto it = se.begin(); it != se.end(); it++) {
    pair<int, int> pr = *it;
    int a = (pr.first + p) % n;
    int b = (pr.second + p) % n;
    if (a > b) swap(a, b);
    new_s.insert(make_pair(a, b));
  }
  return (new_s == se);
}
void swap(int &a, int &b) {
  int temp = a;
  a = b;
  b = temp;
}
void test() {
  int n, m;
  cin >> n >> m;
  set<pair<int, int>> uns;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    if (a > b) swap(a, b);
    uns.insert(make_pair(a, b));
  }
  vector<int> primes;
  int x = n;
  int prev = -1;
  for (int p = 2; p <= x; p++) {
    while (x % p == 0) {
      if (prev != p) {
        primes.push_back(p);
        prev = p;
      }
      x /= p;
    }
  }
  bool ans = false;
  for (int p : primes) {
    if (shift(uns, n / p, n)) {
      ans = true;
      break;
    }
  }
  if (ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  test();
}
