#include <bits/stdc++.h>
using namespace std;
const int nn = 55;
int main() {
  int n, m, a, b;
  set<pair<int, int> > data;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &a, &b);
    if (a > b) swap(a, b);
    data.insert(make_pair(a, b));
  }
  bool ans = 0;
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      set<pair<int, int> > done;
      int k = i;
      bool cek = 1;
      for (set<pair<int, int> >::iterator j = data.begin(); j != data.end();
           ++j) {
        if (done.count(*j) == 0) {
          pair<int, int> tmp = *j;
          int x = tmp.first;
          int y = tmp.second;
          while (done.count(make_pair(x, y)) == 0 &&
                 data.count(make_pair(x, y)) == 1) {
            done.insert(make_pair(x, y));
            x += k;
            y += k;
            if (x > n) x -= n;
            if (y > n) y -= n;
            if (x > y) swap(x, y);
          }
          if (x != tmp.first || y != tmp.second) {
            cek = 0;
            break;
          }
        }
      }
      if (cek) ans = 1;
      done.clear();
      k = n / i;
      if (k == n) continue;
      cek = 1;
      for (set<pair<int, int> >::iterator j = data.begin(); j != data.end();
           ++j) {
        if (done.count(*j) == 0) {
          pair<int, int> tmp = *j;
          int x = tmp.first;
          int y = tmp.second;
          while (done.count(make_pair(x, y)) == 0 &&
                 data.count(make_pair(x, y)) == 1) {
            done.insert(make_pair(x, y));
            x += k;
            y += k;
            if (x > n) x -= n;
            if (y > n) y -= n;
            if (x > y) swap(x, y);
          }
          if (x != tmp.first || y != tmp.second) {
            cek = 0;
            break;
          }
        }
      }
      if (cek) ans = 1;
    }
  }
  if (ans)
    printf("Yes\n");
  else
    printf("No\n");
}
