#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
int n, m, temp;
set<pair<int, int> > g;
pair<int, int> p1;
vector<pair<int, int> > pairs;
bool check(int x) {
  for (auto v : pairs) {
    if (g.count({(v.first + x) % n, (v.second + x) % n}) == 0) return false;
  }
  return true;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    cin >> p1.first >> p1.second;
    p1.first--, p1.second--;
    pairs.push_back(p1);
    g.insert({p1.first, p1.second});
    g.insert({p1.second, p1.first});
  }
  bool ok = false;
  for (int i = 0; i < n - 1; i++) {
    if (n % (i + 1) == 0 && check(i + 1)) {
      ok = true;
      break;
    }
  }
  if (ok)
    puts("Yes");
  else
    puts("No");
  return 0;
}
