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.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Tanya_candies {
	static Scanner in=new Scanner(System.in);
	 static Vector<Integer> Divisors(int n) 
	    { 
	        Vector<Integer> div=new Vector<Integer>(); 
	        for (int i=1; i<=Math.sqrt(n); i++) 
	        { 
	            if (n%i==0) 
	            {  
	                if (n/i == i) 
	                	div.add(i); 
	       
	                else
	                {
	                	div.add(i);
	                	div.add(n/i);
	                }
	            } 
	        }
	        return div;
	    } 
	  
	  /*
	   quick sort for partitioning objects 
	   just change arr to  desired object
	   */
	 static  int partitionObject(int arr[], int low, int high) 
	    { 
	        int pivot = arr[high];  
	        int i = (low-1);  
	        for (int j=low; j<high; j++) 
	        { 
	            if (arr[j] <= pivot) 
	            { 
	                i++;
	                int temp = arr[i]; 
	                arr[i] = arr[j]; 
	                arr[j] = temp; 
	            } 
	        }  
	        int temp = arr[i+1]; 
	        arr[i+1] = arr[high]; 
	        arr[high] = temp; 
	  
	        return i+1; 
	    } 
	  static void sortObject(int arr[], int low, int high) 
	    { 
	        if (low < high) 
	        { 
	            int pi = partitionObject(arr, low, high); 
	            sortObject(arr, low, pi-1); 
	            sortObject(arr, pi+1, high); 
	        } 
	    } 
	  /*
	   					 W
	   					  R
	   	 				   I
	   	  				    T
	   	   					 E 
	   	    
	   	     					Y
	   	      					 O
	   	       					  U 
	   	        				   R 
	   	        
	   	          					  C
	   	           					   O
	   	            			        D
	   	             					 E
	   	              
	   	                					H
	   	                 					 E
	   	                  					  R
	   	                   					   E
	   */
	  static int d, x, y;
static void extendedEuclid(int A, int B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        extendedEuclid(B, A%B);
        int temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}
	  public static void main(String args[]) {
	long k=in.nextInt();
    long n=in.nextInt();
   
    int count=0;
    //System.out.println(n*(n-1));
    if(k>(n*(n-1)))
    System.out.println("NO");
    else{
        System.out.println("YES");
    for(int i=1;i<n+1;i++){
        for(int j=i+1;j<n+1;j++){
           
            
                    //System.out.println(count);
                   
                    if(count<k)
                    {
                        System.out.println(i+" "+j);
                    
                        count++;
                    }
                    if(count<k){
                    System.out.println(j+" "+i);
                    count++;
                    }
                    else
                        break;
        }
        
    }
    }
	  }
		  
	  
	  static boolean isPrime(int num){
		    if ( num > 2 && num%2 == 0 ) {
		        return false;
		    }
		    int top = (int)Math.sqrt(num) + 1;
		    for(int i = 3; i < top; i+=2){
		        if(num % i == 0){
		            return false;
		        }
		    }
		    return true; 
		}
	  static int gcd(int a, int b) 
	    { 
	      if (b == 0) 
	        return a; 
	      return gcd(b, a % b);  
	    } 
}