#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, MOD = 7 + 1e9;
set<pair<int, int> > s;
bool check(int k, int n) {
  for (auto it : s) {
    int x = (it.first + k) % n, y = (it.second + k) % n;
    if (x == 0) x = n;
    if (y == 0) y = n;
    if (s.find({x, y}) == s.end() && s.find({y, x}) == s.end()) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  s.clear();
  for (int i = 1; i <= m; i++) {
    int l, r;
    cin >> l >> r;
    s.insert({l, r});
  }
  for (int i = 1; i < n; i++) {
    if (n % i == 0 && check(i, n)) {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
  return 0;
}
