#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int first, second;
  bool operator<(const Edge &a) const {
    if (first != a.first) return (first > a.first);
    return (second > a.second);
  }
};
struct NewEdge {
  int sz;
  vector<int> vy;
};
int t, m, n, aux, at;
priority_queue<Edge> texto;
vector<int> v;
NewEdge arestas[200010];
Edge edge;
void troca(int *first, int *second) {
  int aux = *first;
  *first = *second;
  *second = aux;
}
bool checa(int k) {
  for (int i = 0; i <= t; i++) {
    aux = v[i];
    at = (aux + k) % n;
    if (arestas[at].sz != arestas[aux].sz) return 0;
    for (int j = 0; j <= arestas[at].sz; j++) {
      if (arestas[at].vy[j] != arestas[aux].vy[j]) return 0;
    }
  }
  return 1;
}
int main() {
  bool achou = 0;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &edge.first, &edge.second);
    edge.first--;
    edge.second--;
    if (edge.first > edge.second) troca(&edge.first, &edge.second);
    texto.push(edge);
  }
  while (!texto.empty()) {
    edge = texto.top();
    texto.pop();
    aux = (edge.second - edge.first) % n;
    arestas[edge.first].vy.push_back(aux);
    aux = (edge.first - edge.second + n) % n;
    arestas[edge.second].vy.push_back(aux);
  }
  for (int i = 0; i <= n - 1; i++) {
    if (!arestas[i].vy.empty()) {
      arestas[i].sz = (int)arestas[i].vy.size() - 1;
      sort(arestas[i].vy.begin(), arestas[i].vy.end());
      v.push_back(i);
    } else
      arestas[i].sz = -1;
  }
  t = (int)v.size() - 1;
  for (int i = 1; i <= t; i++) {
    achou = checa(v[i] - v[0]);
    if (achou) break;
  }
  if (achou)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
