#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);
  for (int i = 0; i < M; i++) cin >> A[i] >> B[i];
  set<pair<int, int>> se;
  for (int i = 0; i < M; i++) {
    A[i]--;
    B[i]--;
    if (A[i] > B[i]) swap(A[i], B[i]);
    se.insert(make_pair(A[i], B[i]));
  }
  vector<int> divs;
  divs.push_back(1);
  for (int i = 2; i * i <= N; i++) {
    if (N % i == 0) {
      if (i == N / i)
        divs.push_back(i);
      else {
        divs.push_back(i);
        divs.push_back(N / i);
      }
    }
  }
  for (int i = 0; i < divs.size(); i++) {
    int d = divs[i];
    bool ng = false;
    for (int j = 0; j < M; j++) {
      int a = (A[j] + d) % N;
      int b = (B[j] + d) % N;
      if (a > b) swap(a, b);
      if (se.find(make_pair(a, b)) == se.end()) {
        ng = true;
        break;
      }
    }
    if (ng == false) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
