#include <bits/stdc++.h>
using namespace std;
double PI = 4.00 * (atan(1));
pair<long long int, long long int> lines[200010];
long long int number, segment;
map<pair<long long int, long long int>, long long int> exist;
bool jumpcheck(long long int jump) {
  bool check = true;
  pair<long long int, long long int> temp;
  for (long long int i = 0; i < segment; i++) {
    temp.first = (lines[i].first - 1 + jump) % number;
    temp.first++;
    temp.second = (lines[i].second - 1 + jump) % number;
    temp.second++;
    if (exist[temp] == 0) {
      check = false;
      break;
    }
  }
  return check;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> number >> segment;
  pair<long long int, long long int> temp;
  for (long long int i = 0; i < segment; i++) {
    cin >> lines[i].first >> lines[i].second;
    temp = {lines[i].second, lines[i].first};
    exist[lines[i]] = exist[temp] = 1;
  }
  set<long long int> divisor;
  for (long long int i = 1; i * i <= number; i++) {
    if (number % i == 0) {
      divisor.insert(i);
      divisor.insert(number / i);
    }
  }
  vector<long long int> final(divisor.begin(), divisor.end());
  long long int size = final.size();
  for (long long int i = 0; i < size - 1; i++) {
    if (jumpcheck(final[i])) {
      cout << "Yes";
      exit(0);
    }
  }
  cout << "No";
  return 0;
}
