#include <bits/stdc++.h>
using namespace std;
using std::cin;
using std::cout;
long long MOD = 998244353;
int main() {
  int n, m;
  cin >> n >> m;
  pair<int, int> arr[m];
  set<pair<int, int> > s;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a %= n;
    b %= n;
    if (b < a) swap(a, b);
    arr[i] = {a, b};
    s.insert(arr[i]);
  }
  for (int i = 1; i <= sqrt(n) + 1; i++) {
    if (n % i == 0) {
      bool a = true;
      for (int c = 0; c < m; c++) {
        int firstelem = (arr[c].first + i) % n;
        int secondelem = (arr[c].second + i) % n;
        if (firstelem > secondelem) swap(firstelem, secondelem);
        if (s.find({firstelem, secondelem}) == s.end()) {
          a = false;
          break;
        }
      }
      if (a) {
        cout << "Yes"
             << "\n";
        return 0;
      }
      if (i != 1) {
        a = true;
        for (int c = 0; c < m; c++) {
          int firstelem = (arr[c].first + n / i) % n;
          int secondelem = (arr[c].second + n / i) % n;
          if (firstelem > secondelem) swap(firstelem, secondelem);
          if (s.find({firstelem, secondelem}) == s.end()) {
            a = false;
            break;
          }
        }
      }
      if (a) {
        cout << "Yes"
             << "\n";
        return 0;
      }
    }
  }
  cout << "No"
       << "\n";
  return 0;
}
