import java.io.*; import java.util.*; class Main { static BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); public static void main(String args[])throws Exception { StringBuilder sb=new StringBuilder(); String s[]=bu.readLine().split(" "); int n=Integer.parseInt(s[0]); m=Integer.parseInt(s[1]); boolean b[][]=new boolean[n+1][n+1]; b[1][1]=b[n][n]=true; m-=2; ArrayList g[]=new ArrayList[2*n+1]; int i,j; for(i=0;i<=2*n;i++) g[i]=new ArrayList<>(); for(i=1;i<=n;i++) for(j=1;j<=n;j++) g[i+j].add(new Pair(i,j)); boolean vis[][]=new boolean[n+1][n+1]; t=2500; for(i=1;i<=n;i++) Arrays.fill(vis[i],false); vis[1][1]=true; for(i=2;i<=n;i++) { vis[1][i]=vis[1][i-1]&b[1][i]; vis[i][1]=vis[i-1][1]&b[i][1]; } for(i=2;i<=n;i++) for(j=2;j<=n;j++) vis[i][j]=b[i][j]&(vis[i-1][j]|vis[i][j-1]); sb.append("Yes\n"); //else sb.append("No\n"); System.out.print(sb); System.out.flush(); return; } static int m,t; static boolean move(boolean vis[][],boolean b[][],ArrayList g[],int l)throws Exception { if(m==0) return false; int n=vis.length-1; boolean ans=false; Queue q=new LinkedList<>(); for(Pair x:g[l]) { if(b[x.x][x.y] && x.x+1<=n && !vis[x.x+1][x.y] && !b[x.x+1][x.y]) { vis[x.x+1][x.y]=true; q.add(new Pair(x.x+1,x.y)); } if(b[x.x][x.y] && x.y+1<=n && !vis[x.x][x.y+1] && !b[x.x][x.y+1]) { vis[x.x][x.y+1]=true; q.add(new Pair(x.x,x.y+1)); } } while(!q.isEmpty()) { if(t<=0) return false; Pair p=q.poll(); System.out.print(p.x+" "+p.y+"\n"); System.out.flush(); t--; String ver=bu.readLine(); if(ver.charAt(0)=='-') return false; if(ver.charAt(0)=='B') { m--; b[p.x][p.y]=true; ans=true; } if(m==0) break; } return ans; } static class Pair { int x,y; Pair(int a,int b) { x=a; y=b; } } }