#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, a[N], b[N];
vector<pair<int, int> > v;
bool check(int k) {
  vector<pair<int, int> > vp;
  for (int i = 1; i <= m; i++) {
    int na = (a[i] + k) % n;
    int nb = (b[i] + k) % n;
    if (na > nb) swap(na, nb);
    vp.push_back({na, nb});
  }
  sort(vp.begin(), vp.end());
  return v == vp;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << setprecision(32);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    if (a[i] < b[i])
      v.push_back({a[i], b[i]});
    else
      v.push_back({b[i], a[i]});
  }
  sort(v.begin(), v.end());
  for (int k = 1; k < n; k++) {
    if (n % k) continue;
    if (check(k)) {
      cout << "Yes\n";
      exit(0);
    }
  }
  cout << "No\n";
  return 0;
}
