#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> a(m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &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());
  vector<int> f;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      f.push_back(i);
      if (i != (n / i)) f.push_back(n / i);
    }
  }
  vector<pair<int, int>> p(m);
  for (int num : f) {
    if (num == n) continue;
    bool ok = 1;
    for (int i = 0; i < m; i++) {
      p[i].first = (a[i].first + num) % n;
      p[i].second = (a[i].second + num) % n;
      if (p[i].first > p[i].second) swap(p[i].first, p[i].second);
    }
    sort(p.begin(), p.end());
    if (p == a) {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
}
