#include <bits/stdc++.h>
using namespace std;
vector<long long> adj[100005];
long long n;
bool check(long long k) {
  vector<long long> te[100005];
  for (long long i = 1; i <= n; i++) {
    long long x = i + k;
    if (x > n) x -= n;
    for (auto j : adj[i]) {
      long long y = j + k;
      if (y > n) y -= n;
      long long tx = min(x, y), ty = max(x, y);
      te[tx].push_back(ty);
    }
  }
  for (long long i = 1; i <= n; i++) {
    sort(te[i].begin(), te[i].end());
    if (te[i] != adj[i]) return 0;
  }
  return 1;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long m;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    if (x > y) swap(x, y);
    adj[x].push_back(y);
  }
  for (long long i = 1; i <= n; i++) sort(adj[i].begin(), adj[i].end());
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      if (check(i) || (i != 1 && check(n / i))) {
        cout << "Yes";
        exit(0);
      }
    }
  }
  cout << "No";
}
