#include <bits/stdc++.h>
using namespace std;
const long long llINF = 9223372036854775807;
const int INF = 2147483647;
const int maxn = 2e5 + 7;
const int maxm = 5e4 + 7;
const long long mod = 998244353;
const double pi = acos(-1.0);
const double eps = 1e-12;
long long n, m;
bool used[maxn];
pair<int, int> Segment[maxn];
vector<long long> d;
set<pair<int, int> > s;
void divide(long long x) {
  for (long long i = 1; i * i <= n; i++) {
    if (x % i == 0) d.push_back(i);
    if (i * i != x) d.push_back(x / i);
  }
}
int get_nxt(int x, int k) { return x + k > n ? (x + k) % n : x + k; }
int main(int argc, char const *argv[]) {
  scanf("%lld%lld", &n, &m);
  divide(n);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &Segment[i].first, &Segment[i].second);
    if (Segment[i].first > Segment[i].second)
      swap(Segment[i].first, Segment[i].second);
    s.insert(Segment[i]);
  }
  for (int kk = 0; kk < d.size(); kk++) {
    long long k = d[kk];
    if (k == n) continue;
    bool flag = true;
    for (int i = 1; i <= m; i++) {
      pair<int, int> nxt_par = make_pair(get_nxt(Segment[i].first, k),
                                         get_nxt(Segment[i].second, k));
      if (nxt_par.first > nxt_par.second) swap(nxt_par.first, nxt_par.second);
      if (!s.count(nxt_par)) {
        flag = false;
        break;
      }
    }
    if (flag) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}
