#include <bits/stdc++.h>
using namespace std;
const int N = 500001;
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int min(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
long long int inf = 100000000000000000;
vector<int> adj[N];
void printDivisors(int n) {
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        printf("%d ", i);
      else
        printf("%d %d ", i, n / i);
    }
  }
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> div;
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i) {
        if (i != n) div.push_back(i);
      } else {
        if (i != n) div.push_back(i);
        if (n / i != n) div.push_back(n / i);
      }
    }
  }
  map<pair<int, int>, int> map;
  vector<pair<int, int> > p(m);
  for (long long int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    p[i] = make_pair(a, b);
    map[p[i]]++;
  }
  for (auto x : div) {
    int f = 1;
    for (long long int i = 0; i < m; i++) {
      pair<int, int> l = p[i];
      int a = l.first + x;
      if (a > n) a = a % n;
      int b = l.second + x;
      if (b > n) b = b % n;
      pair<int, int> k = make_pair(a, b);
      pair<int, int> q = make_pair(b, a);
      if (map[k] == 0 && map[q] == 0) {
        f = 0;
        break;
      }
    }
    if (f == 1) {
      cout << "Yes" << '\n';
      return;
    }
  }
  cout << "No" << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  int t = 0;
  while (t++ < T) {
    solve();
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}
