Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1.

There are m straight segments on the disc, the endpoints of which are all among the aforementioned n points.

Inaka wants to know if her image is rotationally symmetrical, i.e. if there is an integer k (1 ≤ k < n), such that if all segments are rotated clockwise around the center of the circle by k units, the new image will be the same as the original one.

Input

The first line contains two space-separated integers n and m (2 ≤ n ≤ 100 000, 1 ≤ m ≤ 200 000) — the number of points and the number of segments, respectively.

The i-th of the following m lines contains two space-separated integers a_i and b_i (1 ≤ a_i, b_i ≤ n, a_i ≠ b_i) that describe a segment connecting points a_i and b_i.

It is guaranteed that no segments coincide.

Output

Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks).

You can output each letter in any case (upper or lower).

Examples

Input


12 6
1 3
3 7
5 7
7 11
9 11
11 3


Output


Yes


Input


9 6
4 5
5 6
7 8
8 9
1 2
2 3


Output


Yes


Input


10 3
1 2
3 2
7 2


Output


No


Input


10 2
1 6
2 7


Output


Yes

Note

The first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of 120 degrees around the center.

<image>
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Set;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.Comparator;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dmytro.prytula prituladima@gmail.com
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        DFiguriHladni solver = new DFiguriHladni();
        solver.solve(1, in, out);
        out.close();
    }

    static class DFiguriHladni {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            final int n = in.nextInt();
            if (n == 2) {
                out.printLine("YES");
                return;
            }
            final int m = in.nextInt();

            int[] ley = new int[n + 2];

            for (int i = 0; i < m; i++) {
                int a = in.nextInt();
                int b = in.nextInt();
                int min = Math.min(a, b);
                int max = Math.max(a, b);
                a = min;
                b = max;
                int h = n / 2;
                if (b - a > h) {
                    color(ley, b, ley.length - 1);
                    color(ley, 1, a + 1);
                } else if (b - a < h) {
                    color(ley, a, b + 1);
                } else
//                if (n >= 4)
                {
                    int Q1 = a + 1, Q2 = b - 1, P1 = b + 1, P2 = a - 1;
                    if (P2 == 0) {
                        P2 = n;
                        color(ley, P1, ley.length - 1);
                    } else {
                        color(ley, P1, ley.length - 1);
                        color(ley, 1, P2 + 1);
                    }


                    color(ley, Q1, Q2 + 1);


                }
            }
            for (int i = 1; i < ley.length; i++) {
                ley[i] += ley[i - 1];
            }

//        out.print(ley);
            Set<Integer> divisors = new HashSet<>();
            for (int i = 1; i * i <= n; i++) {
                if (n % i == 0) {
                    divisors.add(i);
                    divisors.add(n / i);
                }
            }

            divisors.remove(n);
            List<Integer> list = new ArrayList<>(divisors);
            list.sort(Comparator.reverseOrder());

            boolean ok = false;
            for (int div : list) {
                ok |= okWithK(ley, div);
            }
            if (ok) {
                out.printLine("Yes");
            } else {
                out.printLine("No");
            }

        }

        private void color(int[] lay, int L, int R) {
            lay[L]++;
            lay[R]--;
        }

        private boolean okWithK(int[] a, int p) {
            boolean ok = true;
            for (int i = 1; i <= p; i++) {
                int cur = a[i];
                for (int j = i + p; j <= a.length - 2; j += p) {
                    ok &= cur == a[j];
                }
            }
            return ok;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        private int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        private static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public OutputWriter print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
            return this;
        }

        public OutputWriter printLine(Object... objects) {
            print(objects);
            writer.println();
            return this;
        }

        public void close() {
            writer.close();
        }

    }
}

