#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 1e5;
vector<pair<int, int>> arr;
unordered_map<int, unordered_map<int, int>> m;
long long int n, k;
bool check(int k) {
  for (auto &i : arr) {
    int a = i.first + k;
    int b = i.second + k;
    if (a > n) a -= n;
    if (b > n) b -= n;
    bool p = false;
    if (m.find(a) != m.end() && m[a].find(b) != m[a].end()) p = true;
    if (m.find(b) != m.end() && m[b].find(a) != m[b].end()) p = true;
    if (!p) return false;
  }
  return true;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    int a, b;
    cin >> a >> b;
    arr.push_back(make_pair(a, b));
    m[a][b]++;
    m[b][a]++;
  }
  for (int i = 1; i * i <= n; ++i) {
    if (n % i != 0) continue;
    int d1 = n / i;
    int d2 = i;
    if (d1 != n && check(d1)) {
      cout << "Yes\n";
      return 0;
    }
    if (d2 != n && check(d2)) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}
