#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, m, x, y;
vector<int> d;
pair<int, int> a[N], b[N];
int main() {
  scanf("%d%d", &n, &m);
  d.push_back(1);
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      d.push_back(i);
      d.push_back(n / i);
    }
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    x--;
    y--;
    if (x > y) swap(x, y);
    a[i] = make_pair(x, y);
  }
  sort(a + 1, a + m + 1);
  bool f;
  for (auto i : d) {
    for (int j = 1; j <= m; ++j) {
      x = a[j].first + i;
      y = a[j].second + i;
      x %= n;
      y %= n;
      if (x > y) swap(x, y);
      b[j] = make_pair(x, y);
    }
    sort(b + 1, b + m + 1);
    f = 1;
    for (int j = 1; j <= m; ++j) {
      if (a[j] != b[j]) {
        f = 0;
        break;
      }
    }
    if (f) {
      break;
    }
  }
  if (f)
    puts("Yes");
  else
    puts("No");
  return 0;
}
