#include <bits/stdc++.h>
using namespace std;
int n, m;
set<int> e[100000] = {};
bool find(int p) {
  for (int i = 0; i < p; ++i) {
    for (int j = 1; j < n / p; ++j) {
      if (e[i] != e[i + j * p]) {
        return false;
      }
    }
  }
  return true;
}
void solve(int x) {
  bool found = false;
  for (int i = 1; i < x; ++i) {
    if (x % i == 0 && find(i)) {
      found = true;
      break;
    }
  }
  if (found) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    int diff = ((v + n) - u) % n;
    e[u - 1].insert(diff);
    e[v - 1].insert(n - diff);
  }
  solve(n);
  cout.flush();
  return 0;
}
