Problem: The king of Berland organizes a ball! n pair are invited to the ball, they are numbered from 1 to n. Each pair consists of one man and one woman. Each dancer (either man or woman) has a monochrome costume. The color of each costume is represented by an integer from 1 to k, inclusive.

Let b_i be the color of the man's costume and g_i be the color of the woman's costume in the i-th pair. You have to choose a color for each dancer's costume (i.e. values b_1, b_2, ..., b_n and g_1, g_2, ... g_n) in such a way that:

  1. for every i: b_i and g_i are integers between 1 and k, inclusive; 
  2. there are no two completely identical pairs, i.e. no two indices i, j (i ≠ j) such that b_i = b_j and g_i = g_j at the same time; 
  3. there is no pair such that the color of the man's costume is the same as the color of the woman's costume in this pair, i.e. b_i ≠ g_i for every i; 
  4. for each two consecutive (adjacent) pairs both man's costume colors and woman's costume colors differ, i.e. for every i from 1 to n-1 the conditions b_i ≠ b_{i + 1} and g_i ≠ g_{i + 1} hold. 



Let's take a look at the examples of bad and good color choosing (for n=4 and k=3, man is the first in a pair and woman is the second):

Bad color choosing: 

  * (1, 2), (2, 3), (3, 2), (1, 2) — contradiction with the second rule (there are equal pairs); 
  * (2, 3), (1, 1), (3, 2), (1, 3) — contradiction with the third rule (there is a pair with costumes of the same color); 
  * (1, 2), (2, 3), (1, 3), (2, 1) — contradiction with the fourth rule (there are two consecutive pairs such that colors of costumes of men/women are the same). 



Good color choosing: 

  * (1, 2), (2, 1), (1, 3), (3, 1); 
  * (1, 2), (3, 1), (2, 3), (3, 2); 
  * (3, 1), (1, 2), (2, 3), (3, 2). 



You have to find any suitable color choosing or say that no suitable choosing exists.

Input

The only line of the input contains two integers n and k (2 ≤ n, k ≤ 2 ⋅ 10^5) — the number of pairs and the number of colors.

Output

If it is impossible to find any suitable colors choosing, print "NO".

Otherwise print "YES" and then the colors of the costumes of pairs in the next n lines. The i-th line should contain two integers b_i and g_i — colors of costumes of man and woman in the i-th pair, respectively.

You can print each letter in any case (upper or lower). For example, "YeS", "no" and "yES" are all acceptable.

Examples

Input


4 3


Output


YES
3 1
1 3
3 2
2 3


Input


10 4


Output


YES
2 1
1 3
4 2
3 4
4 3
3 2
2 4
4 1
1 4
3 1


Input


13 4


Output


NO

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;
import java.lang.*;


public class Main implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

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

        public 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 String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        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;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

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

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

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

    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(), "Main", 1 << 26).start();
    }

    static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    static int gcd(int a, int b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    static long modPow(long a, long p, long m) {
        if (a == 1) return 1;
        long ans = 1;
        while (p > 0) {
            if (p % 2 == 1) ans = (ans * a) % m;
            a = (a * a) % m;
            p >>= 1;
        }
        return ans;
    }

    static long modInv(long a, long m) {
        return modPow(a, m - 2, m);
    }

    static long sol_x, sol_y, gcd_a_b;

    static void extendedEuclid(long a, long b) {
        if (b == 0) {
            gcd_a_b = a;
            sol_x = 1;
            sol_y = 0;
        } else {
            extendedEuclid(b, a % b);
            long temp = sol_x;
            sol_x = sol_y;
            sol_y = temp - (a / b) * sol_y;
        }
    }

    long modInverse(long a, long prime)
    {
        a = a % prime;
        for (int x=1; x<prime; x++)
            if ((a*x) % prime == 1)
                return x;

        return -1;
    }

    static class Bhavansort {
        Random random;

        Bhavansort(int a[]) {
            randomArray(a);
            sort(a);
        }

        Bhavansort(long a[]) {
            randomArray(a);
            sort(a);
        }

        static int[] sort(int a[]) {
            Arrays.sort(a);
            return a;
        }

        static long[] sort(long a[]) {
            Arrays.sort(a);
            return a;
        }

        void randomArray(long a[]) {
            int n = a.length;
            for (int i = 0; i < n; i++) {
                int p = random.nextInt(n) % n;
                long tm = a[i];
                a[i] = a[p];
                a[p] = tm;
            }
        }

        void randomArray(int a[]) {
            int n = a.length;
            for (int i = 0; i < n; i++) {
                int p = random.nextInt(n) % n;
                int tm = a[i];
                a[i] = a[p];
                a[p] = tm;
            }
        }
    }


    public void run() {
        InputReader sc = new InputReader(System.in);
        //Scanner sc=new Scanner(System.in);
        // Random rn=new Random();
        PrintWriter out = new PrintWriter(System.out);

        int n=sc.nextInt();
        int k=sc.nextInt();

        if(1L*k*(k-1)>=n){
            out.println("YES");
            int counter=1;
            int ans[][]=new int[n][2];
            for (int i = 0; i <n ; i++) {
                ans[i][0]=i%k;
            }
            for (int i = 0; i <n ; i+=k) {
                int tt=counter;
                for (int j = 0; j<k && j+i<n  ; j++) {
                    ans[j+i][1]=tt%k;
                    tt++;
                }
                counter++;
            }

            for (int i = 0; i <n ; i++) {
                for (int j = 0; j <2 ; j++) {
                    out.print((ans[i][j]+1)+" ");
                }
                out.println();
            }
        }
        else{
            out.println("NO");
        }

        out.close();

    }


}