#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 * 2].first >> a[i * 2].second;
    a[i * 2].first--;
    a[i * 2].second--;
    a[i * 2 + 1] = a[i * 2];
    swap(a[i * 2 + 1].first, a[i * 2 + 1].second);
  }
  m *= 2;
  sort(a, a + m);
  for (int i = 0; i < m; i++) {
    g[a[i].first].push_back(a[i].second);
  }
  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) % n;
        b[j].second = (a[j].second + i) % n;
        gr[b[j].first].push_back(b[j].second);
      }
      int ok = 1;
      for (int j = 0; ok && j < n; j++) {
        if (gr[j].size() != g[j].size()) {
          ok = 0;
        } else {
          if (gr[j].size() == 0) continue;
          vector<int> cur;
          int t = 0;
          while (t + 1 < gr[j].size() && gr[j][t] <= gr[j][t + 1]) t++;
          for (int x = 0; x < gr[j].size(); x++) {
            cur.push_back(gr[j][(x + t + 1) % gr[j].size()]);
          }
          ok &= cur == g[j];
        }
      }
      if (ok) {
        cout << "Yes\n";
        return;
      }
    }
  }
  cout << "No\n";
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
