#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)5e5 + 100;
const long long inf = (1ll << 60);
const int mod2 = (int)998244353;
const int mod = (int)1e9 + 7;
string s;
int n;
pair<int, int> a[maxn];
pair<int, int> b[maxn];
int m;
int cnt[maxn];
vector<int> g[maxn];
vector<int> gr[maxn];
void solve() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i].first >> a[i].second;
    a[i].first--;
    a[i].second--;
  }
  sort(a, a + m);
  for (int i = 0; i < m; i++) {
    g[a[i].first].push_back(a[i].second);
    g[a[i].second].push_back(a[i].first);
  }
  for (int i = 0; i < n; i++) sort(g[i].begin(), g[i].end());
  for (int i = 1; i < n; i++) {
    if (n % i == 0) {
      for (int j = 0; j < n; j++) {
        gr[j].clear();
      }
      for (int j = 0; j < m; j++) {
        b[j].first = (a[j].first + i);
        if (b[j].first >= n) b[j].first -= n;
        b[j].second = (a[j].second + i);
        if (b[j].second >= n) b[j].second -= n;
        gr[b[j].first].push_back(b[j].second);
        gr[b[j].second].push_back(b[j].first);
      }
      int ok = 1;
      for (int j = 0; ok && j < n; j++) {
        if (gr[j].size() != g[j].size()) {
          ok = 0;
        } else {
          for (int x : g[j]) cnt[x]++;
          for (int x : gr[j]) {
            if (cnt[x] > 0) {
              cnt[x]--;
            } else {
              ok = 0;
            }
          }
          for (int x : g[j]) cnt[x] = 0;
        }
      }
      if (ok) {
        cout << "Yes\n";
        return;
      }
    }
  }
  cout << "No\n";
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
