#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
vector<pair<int, int> > segs;
map<pair<int, int>, int> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> divs;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      divs.push_back(i);
      if (n / i != i && i != 1) divs.push_back(n / i);
    }
  }
  segs.resize(m);
  for (int i = 0; i < m; i++) {
    cin >> segs[i].first >> segs[i].second;
    mp[segs[i]] = 1;
    mp[{segs[i].second, segs[i].first}] = 1;
  }
  for (int x : divs) {
    bool ok = 1;
    for (int i = 0; i < m; i++) {
      auto [a, b] = segs[i];
      a += x;
      b += x;
      if (a > n) a %= n;
      if (b > n) b %= n;
      if (mp.find({a, b}) == mp.end()) {
        ok = 0;
        break;
      }
    }
    if (ok) {
      return cout << "Yes", 0;
    }
  }
  cout << "No";
}
