#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("tune=native")
using namespace std;
const int DEBUG = 0;
mt19937 gen(
    (unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
#pragma comment(linker, "/STACK:67108864")
int ok(const vector<pair<int, int> >& edges, int k, int n) {
  vector<pair<int, int> > cur(edges.size());
  for (int i = 0; i < edges.size(); i++) {
    int l = edges[i].first;
    int r = edges[i].second;
    cur[i] = {l + k, r + k};
    if (cur[i].first >= n) cur[i].first -= n;
    if (cur[i].second >= n) cur[i].second -= n;
    if (cur[i].first > cur[i].second) swap(cur[i].first, cur[i].second);
  }
  sort(cur.begin(), cur.end());
  for (int i = 0; i < cur.size(); i++)
    if (cur[i] != edges[i]) return 0;
  return 1;
}
int smart(int n, vector<pair<int, int> > edges) {
  sort(edges.begin(), edges.end());
  for (int x = 1; x * x <= n; x++)
    if (n % x == 0) {
      if (ok(edges, x, n)) return 1;
      if (x != 1 && ok(edges, n / x, n)) return 1;
    }
  return 0;
}
int brute(int n, vector<pair<int, int> > edges) {
  sort(edges.begin(), edges.end());
  for (int x = 1; x < n; x++)
    if (ok(edges, x, n)) return 1;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(cout.fixed);
  cout.precision(8);
  int nv, ne;
  cin >> nv >> ne;
  vector<pair<int, int> > edges(ne);
  for (pair<int, int>& e : edges) {
    cin >> e.first >> e.second;
    --e.first;
    --e.second;
    if (e.first > e.second) swap(e.first, e.second);
  }
  cout << (smart(nv, edges) ? "Yes" : "No");
  return 0;
}
