#include <bits/stdc++.h>
using namespace std;
const long long maxn = 5e5 + 5;
void getZarr(vector<int>& str, int Z[]) {
  int n = str.size();
  int L, R, k;
  L = R = 0;
  for (int i = 1; i < n / 2 + 1; ++i) {
    if (i > R) {
      int l = i, r = i;
      while (r < n && str[r - l] == str[r]) r++;
      Z[i] = r - l;
      r--;
      if (Z[i] > 0) {
        R = r;
        L = l;
      }
    } else {
      k = i - L;
      if (Z[k] < R - i + 1)
        Z[i] = Z[k];
      else if (Z[k] > R - i + 1)
        Z[i] = R - i + 1;
      else {
        L = i;
        R++;
        while (R < n && str[R] == str[R - L]) R++;
        Z[i] = R - L;
        R--;
      }
    }
  }
}
inline int clockwise(int a, int b, int n) {
  if (a < b) {
    return b - a;
  }
  return n - (a - b);
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > v(n);
  for (int(i) = 0; (i) < (m); (i)++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    v[a].push_back(clockwise(a, b, n));
    v[b].push_back(clockwise(b, a, n));
  }
  for (int(i) = 0; (i) < (n); (i)++) sort((v[i]).begin(), (v[i]).end());
  vector<int> zstr;
  for (auto it : v) {
    for (auto it1 : it) {
      zstr.push_back(it1);
    }
    zstr.push_back(-1);
  }
  int x = zstr.size();
  for (int(i) = 0; (i) < (x); (i)++) zstr.push_back(zstr[i]);
  int z[maxn];
  getZarr(zstr, z);
  for (int(i) = 0; (i) < (x - 1); (i)++) {
    if (z[i + 1] >= x) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
