#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<pair<int, int> > s;
bool test(int k) {
  if (k == n) return 0;
  vector<pair<int, int> > cur;
  for (auto p : s) {
    p.first = (p.first + k) % n;
    p.second = (p.second + k) % n;
    if (p.first > p.second) swap(p.first, p.second);
    cur.push_back(p);
  }
  sort(cur.begin(), cur.end());
  return (cur == s);
}
int main() {
  scanf("%d%d", &n, &m);
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    if (a > b) swap(a, b);
    s.push_back({a, b});
  }
  sort(s.begin(), s.end());
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0 && (test(i) || test(n / i))) {
      printf("Yes");
      return 0;
    }
  }
  printf("No");
}
