#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, bool> mp;
pair<int, int> ara[400005];
int main() {
  int n, m, x;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &ara[i].first, &ara[i].second);
    ara[i].first %= n, ara[i].second %= n;
    if (ara[i].first > ara[i].second) swap(ara[i].first, ara[i].second);
    ara[i + m] = ara[i], mp[ara[i]] = 1;
  }
  bool f = 0;
  for (int i = 1; i * i <= n && !f; i++)
    if (!(n % i)) {
      x = i;
      bool f2 = 1;
      for (int j = 1; j <= m && f2; j++) {
        int a = (ara[j].first + x) % n;
        int b = (ara[j].second + x) % n;
        if (a > b) swap(a, b);
        f2 = mp[{a, b}];
      }
      f = f2;
      x = (n / i);
      if (x == n || f) continue;
      f2 = 1;
      for (int j = 1; j <= m && f2; j++) {
        int a = (ara[j].first + x) % n;
        int b = (ara[j].second + x) % n;
        if (a > b) swap(a, b);
        f2 = mp[{a, b}];
      }
      f = f2;
    }
  if (f)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
