#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, m;
set<pair<int, int> > fd;
vector<pair<int, int> > todo;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  int x, y;
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    x = x % n;
    y = y % n;
    if (x > y) swap(x, y);
    todo.push_back(make_pair(x, y));
    fd.insert(make_pair(x, y));
  }
  bool flag;
  for (int i = 1; i < n; i++) {
    if (n % i != 0) continue;
    flag = 0;
    for (auto p : todo) {
      x = p.first;
      y = p.second;
      x = (x + i) % n;
      y = (y + i) % n;
      if (x > y) swap(x, y);
      if (fd.find(make_pair(x, y)) == fd.end()) {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
