#include <bits/stdc++.h>
using namespace std;
long long modd = 1000 * 1000 * 1000 + 7;
template <class T>
T fastpower(T a, long long n) {
  if (n % 2 == 0) {
    T halfpower = fastpower<T>(a, n / 2);
    return (halfpower * halfpower) % modd;
  } else {
    if (n == 1) {
      return a;
    } else {
      T halfpower = fastpower<T>(a, n / 2);
      return (((halfpower * halfpower) % modd) * a) % modd;
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cout.precision(17);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  uniform_int_distribution<int> rand_gen(0, 1000);
  int test_cases = 1;
  for (int t = (1); t < (1) + (test_cases); ++t) {
    int n;
    cin >> n;
    int m;
    cin >> m;
    int n_orig(n);
    map<int, vector<int>> strings;
    for (int i = (0); i < (0) + (m); ++i) {
      int kk;
      cin >> kk;
      int kk2;
      cin >> kk2;
      kk--;
      kk2--;
      if (kk2 < kk) {
        swap(kk, kk2);
      }
      int length = min(kk2 - kk, n + kk - kk2);
      if (length == kk2 - kk) {
        strings[length].push_back(kk);
      } else {
        strings[length].push_back(kk2);
      }
    }
    for (auto& x : strings) {
      sort(x.second.begin(), x.second.end());
    }
    set<int> primes;
    int p = 2;
    while (p * p <= n) {
      if (n % p == 0) {
        primes.insert(p);
        n /= p;
      } else {
        p++;
      }
    }
    if (n != 1) {
      primes.insert(n);
    }
    for (auto pp : primes) {
      bool is_ok = true;
      for (auto x : strings) {
        if ((pp == 2) && (x.first == n_orig / 2)) {
          continue;
        }
        if (x.second.size() % pp != 0) {
          is_ok = false;
          break;
        }
        int dist = x.second.size() / pp;
        for (int i = (0); i < (0) + (x.second.size()); ++i) {
          if ((x.second[i] + (n_orig / pp) -
               x.second[(i + dist) % x.second.size()]) %
                  n !=
              0) {
            is_ok = false;
            break;
          }
        }
        if (!is_ok) {
          break;
        }
      }
      if (is_ok) {
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
  }
  return 0;
}
