#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
long long a[N];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > v;
  int x, y;
  set<long long> s;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    x--, y--;
    v.push_back({x, y});
    s.insert(x * N + y);
    s.insert(y * N + x);
  }
  int yo = sqrtl(n);
  for (int i = 1; i <= yo; i++) {
    if (n % i == 0) {
      int flag = 0;
      for (auto j : v) {
        x = j.first, y = j.second;
        x = (x + i) % n, y = (y + i) % n;
        if (s.find(x * N + y) == s.end() && s.find(y * N + x) == s.end()) {
          flag = 1;
          break;
        }
      }
      if (!flag) {
        return cout << "Yes", 0;
      }
    }
    int temp = i;
    if (n % (n / i) == 0 && i != 1) {
      i = n / i;
      int flag = 0;
      for (auto j : v) {
        x = j.first, y = j.second;
        x = (x + i) % n, y = (y + i) % n;
        if (s.find(x * N + y) == s.end() && s.find(y * N + x) == s.end()) {
          flag = 1;
          break;
        }
      }
      if (!flag) {
        return cout << "Yes", 0;
      }
    }
    i = temp;
  }
  cout << "No";
  return 0;
}
