#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
using namespace std;
const long long hell = 1000000007;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long t = power(a, b / 2);
  t %= hell;
  t *= t;
  t %= hell;
  if (b % 2)
    return (t * a) % hell;
  else
    return t;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b - a % b, a % b);
}
long long digitsum(long long x) {
  while (x > 9) {
    long long ans = 0;
    while (x != 0) {
      ans += x % 10;
      x /= 10;
    }
    x = ans;
  }
  return x;
}
long long pw(long long a, long long b) {
  long long x = a;
  for (long long i = 1; i < b; i++) {
    a = a * x;
  }
  return a;
}
bool b[100010] = {false};
void pri() {
  b[1] = true;
  b[2] = true;
  b[0] = true;
  for (long long i = 2; i < 100010; i++) {
    for (long long j = i + i; j < 100010; j += i) b[j] = true;
  }
}
long long solve() {
  long long n, m;
  cin >> n >> m;
  vector<pair<long long, long long> > a, a1;
  map<pair<long long, long long>, long long> mm;
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    if (x % n > y % n) swap(x, y);
    a.push_back({x % n, y % n});
    mm[{x % n, y % n}] = 5;
  }
  vector<long long> v;
  for (long long i = 1; i < n; i++) {
    if (n % i == 0) v.push_back(i);
  }
  for (long long j = 0; j < v.size(); j++) {
    bool bb = true;
    for (long long i = 0; i < m; i++) {
      long long x = a[i].first + v[j];
      long long y = a[i].second + v[j];
      x = x % n;
      y = y % (n);
      long long mn, mx;
      if (x > y)
        mx = x, mn = y;
      else
        mx = y, mn = x;
      if (mm[{mn, mx}] != 5) {
        bb = false;
        break;
      }
    }
    if (bb) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}
signed main() {
  long long t = 1;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin.exceptions(cin.failbit);
  clock_t time_req;
  time_req = clock();
  long long k = 1;
  while (t--) {
    solve();
  }
  time_req = clock() - time_req;
  return 0;
}
