#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 1e6 + 5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  set<long long> adj[n];
  while (m-- > 0) {
    long long a, b;
    cin >> a >> b;
    a -= 1, b -= 1;
    adj[a].insert(b);
    adj[b].insert(a);
  }
  for (long long i = 1; i < n; i++) {
    if (n % i) continue;
    bool flg = true;
    for (long long u = 0; u < n; u++) {
      for (set<long long>::iterator itr = adj[u].begin(); itr != adj[u].end();
           itr++) {
        long long v = *itr;
        if (adj[(u + i) % n].find((v + i) % n) == adj[(u + i) % n].end())
          flg = false;
      }
    }
    if (flg) return cout << "Yes\n", 0;
  }
  cout << "No";
}
