#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int n, m;
vector<pair<int, int> > vec;
int qt[(int)(3 * 1e5 + 10)];
vector<int> divs;
void takeDiv() {
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        divs.push_back(i);
      else
        divs.push_back(i), divs.push_back(n / i);
    }
  }
}
bool solve(int k) {
  vector<pair<int, int> > vec2 = vec;
  for (int i = 0; i < int(vec2.size()); i++) {
    vec2[i].first = (vec2[i].first + k) % n;
    vec2[i].second = (vec2[i].second + k) % n;
    if (vec2[i].first > vec2[i].second) swap(vec2[i].first, vec2[i].second);
  }
  sort(vec2.begin(), vec2.end());
  for (int i = 0; i < int(vec2.size()); i++) {
    if (vec[i].first != vec2[i].first or (vec[i].second != vec2[i].second)) {
      return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    if (a > b) swap(a, b);
    vec.push_back({a, b});
  }
  sort(vec.begin(), vec.end());
  takeDiv();
  for (auto i : divs) {
    if (i == n) continue;
    if (solve(i)) {
      cout << "Yes"
           << "\n";
      return 0;
    }
  }
  cout << "No"
       << "\n";
  return 0;
}
