#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " , ";
  __f(comma + 1, args...);
}
int n, m;
vector<pair<int, int> > a;
bool check(int k) {
  int i;
  vector<pair<int, int> > c(m);
  for (i = 0; i < m; ++i) {
    c[i].first = (a[i].first + k) % n;
    c[i].second = (a[i].second + k) % n;
    if (c[i].first > c[i].second) swap(c[i].first, c[i].second);
  }
  sort(c.begin(), c.end());
  return c == a;
}
int main() {
  ios::sync_with_stdio(0);
  int i, j, k;
  cin >> n >> m;
  a.resize(m);
  for (i = 0; i < m; ++i) {
    cin >> a[i].first >> a[i].second;
    a[i].first--;
    a[i].second--;
    if (a[i].first > a[i].second) swap(a[i].first, a[i].second);
  }
  sort(a.begin(), a.end());
  bool can = false;
  for (i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      can = can || check(i);
      if (n / i != n) can = can || check(n / i);
    }
  }
  cout << (can ? "Yes\n" : "No\n");
  return 0;
}
