Problem: Students went into a class to write a test and sat in some way. The teacher thought: "Probably they sat in this order to copy works of each other. I need to rearrange them in such a way that students that were neighbors are not neighbors in a new seating."

The class can be represented as a matrix with n rows and m columns with a student in each cell. Two students are neighbors if cells in which they sit have a common side.

Let's enumerate students from 1 to n·m in order of rows. So a student who initially sits in the cell in row i and column j has a number (i - 1)·m + j. You have to find a matrix with n rows and m columns in which all numbers from 1 to n·m appear exactly once and adjacent numbers in the original matrix are not adjacent in it, or determine that there is no such matrix.

Input

The only line contains two integers n and m (1 ≤ n, m ≤ 105; n·m ≤ 105) — the number of rows and the number of columns in the required matrix.

Output

If there is no such matrix, output "NO" (without quotes). 

Otherwise in the first line output "YES" (without quotes), and in the next n lines output m integers which form the required matrix.

Examples

Input

2 4


Output

YES
5 4 7 2 
3 6 1 8 


Input

2 1


Output

NO

Note

In the first test case the matrix initially looks like this:
    
    
      
    1 2 3 4  
    5 6 7 8  
    

It's easy to see that there are no two students that are adjacent in both matrices.

In the second test case there are only two possible seatings and in both of them students with numbers 1 and 2 are neighbors.

Solution (in JAVA):

Solution:
import java.util.Scanner;
import java.util.HashSet;

public class Solution {
  static int rows, cols, total;
  static boolean test(int[][] mat, int rows, int cols) {
    boolean used[] = new boolean[rows * cols];
    for(int r = 0; r < rows; ++r) {
      for(int c = 0; c < cols; ++c) {
        int v = mat[r][c];
        if(v >= rows * cols || v < 0) {
          System.out.printf("illegal student %d at (%d, %d)%n", v, r, c);
          return false;
        }
        if(used[v]) {
          System.out.printf("duble use of %d at (%d, %d)%n", v, r, c);
          return false;
        }
        used[v] = true;
        HashSet<Integer> nn = new HashSet<>();
        nn.add(v - cols);
        nn.add(v % cols == 0 ? -1 : v - 1);
        nn.add(v + cols);
        nn.add(v % cols == cols - 1 ? -1 : v + 1);
        if(r > 0 && nn.contains(mat[r-1][c])) {
          System.out.printf("top at %d %d%n", r, c);
          return false;
        }
        if(c > 0 && nn.contains(mat[r][c-1])) {
          System.out.printf("left at %d %d%n", r, c);
          return false;
        }
        if(r < rows-1 && nn.contains(mat[r+1][c])) {
          System.out.printf("bottom at %d %d%n", r, c);
          return false;
        }
        if(c < cols-1 && nn.contains(mat[r][c+1])) {
          System.out.printf("right at %d %d%n", r, c);
          return false;
        }
      }
    }
    return true;
  }
  static boolean canFill(boolean[] used, int[][] mat, int r, int c, int rows, int cols) {
    if(r == rows) {
      if(!test(mat, rows, cols)) throw new Error("Wrong matrix!");
      // System.out.println("YES");
      // for(int i = 0; i < rows; ++i) {
      //   for(int j = 0; j < cols; ++j) {
      //     System.out.printf("%d ", mat[i][j]);
      //   }
      //   System.out.println("");
      // }
      return true;
    }
    for(int i = rows * cols - 1; i >= 0; --i) {
      if(used[i]) continue;
      if(cols > 1 && c == cols - 1 && i % cols == cols - 1) continue;
      if(rows > 1 && r == rows - 1 && i / cols == rows - 1) continue;
      int top = i - cols, left = (i % cols == 0 ? -1 : i - 1),
        bottom = i + cols, right = (i % cols == cols - 1 ? -1 : i + 1);
      if(r > 0 && (mat[r - 1][c] == top ||mat[r - 1][c] == bottom ||mat[r - 1][c] == left ||mat[r - 1][c] == right)) continue;
      if(c > 0 && (mat[r][c - 1] == top ||mat[r][c - 1] == bottom ||mat[r][c - 1] == left ||mat[r][c - 1] == right)) continue;
      used[i] = true;
      mat[r][c] = i;
      if(c == cols - 1) {
        if(canFill(used, mat, r + 1, 0, rows, cols)) return true;
      } else {
        if(canFill(used, mat, r, c + 1, rows, cols)) return true;
      }
      used[i] = false;
    }
    return false;
  }

  public static void print(int[][] mat, int rows, int cols) {
    for(int r = 0; r < rows; ++r) {
      for(int c = 0; c < cols; ++c) {
        if(c > 0) System.out.print(" ");
        System.out.print(mat[r][c] + 1);
      }
      System.out.println("");
    }
  }

  public static void main(String... args) {
    Scanner ins = new Scanner(System.in);
    if(args.length > 0) {
      String noop = ins.next();
      rows = Integer.parseInt(args[0]);
      cols = Integer.parseInt(args[1]);
      int[][] mat = new int[rows][cols];
      for(int r = 0; r < rows; ++r) {
        for(int c = 0; c < cols; ++c) {
          mat[r][c] = ins.nextInt() - 1;
        }
      }
      if(test(mat, rows, cols)) {
        System.out.println("OK");
      } else {
        System.out.println("FAIL");
        System.exit(-1);
      }
      return;
    }
    rows = ins.nextInt();
    cols = ins.nextInt();
    if(rows == 1 && cols == 1) {
      System.out.printf("YES%n1%n");
      return;
    }
    if(rows <= 3 && cols <= 3) {
      int[][] mat = new int[rows][cols];
      if(canFill(new boolean[rows * cols], mat, 0, 0, rows, cols)) {
        System.out.println("YES");
        print(mat, rows, cols);
      } else {
        System.out.println("NO");
      }
      return;
    }
    if(rows < 3) {
      solve(rows, 4);
      return;
    }
    if(cols < 3) {
      solve(4, cols);
      return;
    }
    solve(3,3);
  }

  public static void solve(int stampRows, int stampCols) {
    int[][][][] all = new int[2 * stampRows][2 * stampCols][2 * stampRows][2 * stampCols];
    for(int i = stampRows; i < 2 * stampRows; ++i) {
      for(int j = stampCols; j < 2 * stampCols; ++j) {
        if(!canFill(new boolean[i * j], all[i][j], 0, 0, i, j))
          throw new Error("Unable to fill " + i + "x" +j);
        // System.out.printf("%d %d%n", i, j);
        // print(all[i][j], i, j);
      }
    }
    int totalRows = rows / stampRows;
    int totalCols = cols / stampCols;
    boolean hasExtraRow = rows % stampRows > 0,
      hasExtraCol = cols % stampCols > 0;
    int extraRowSize = stampRows + rows % stampRows,
      extraColSize = stampCols + cols % stampCols;
    if(hasExtraRow) --totalRows;
    if(hasExtraCol) --totalCols;
    System.out.println("YES");
    for(int bigR = 0; bigR < totalRows; ++bigR) {
      for(int smallR = 0; smallR < stampRows; ++smallR) {
        for(int bigC = 0; bigC < totalCols; ++bigC) {
          for(int smallC = 0; smallC < stampCols; ++smallC) {
            int v = all[stampRows][stampCols][smallR][smallC];
            int smallR2 = v / stampCols;
            int smallC2 = v % stampCols;
            int r = (stampRows * bigR + smallR2) * cols + stampCols * bigC + smallC2;
            System.out.printf("%d ", r + 1);
          }
        }
        if(hasExtraCol) {
          for(int smallC = 0; smallC < extraColSize; ++smallC) {
            int v = all[stampRows][extraColSize][smallR][smallC];
            int smallR2 = v / extraColSize;
            int smallC2 = v % extraColSize;
            int r = (stampRows * bigR + smallR2) * cols + stampCols * totalCols + smallC2;
            System.out.printf("%d ", r + 1);
          }
        }
        System.out.println("");
      }
    }
    if(hasExtraRow) {
      for(int smallR = 0; smallR < extraRowSize; ++smallR) {
        for(int bigC = 0; bigC < totalCols; ++bigC) {
          for(int smallC = 0; smallC < stampCols; ++smallC) {
            int v = all[extraRowSize][stampCols][smallR][smallC];
            int smallR2 = v / stampCols;
            int smallC2 = v % stampCols;
            int r = (stampRows * totalRows + smallR2) * cols + stampCols * bigC + smallC2;
            System.out.printf("%d ", r + 1);
          }
        }
        if(hasExtraCol) {
          for(int smallC = 0; smallC < extraColSize; ++smallC) {
            int v = all[extraRowSize][extraColSize][smallR][smallC];
            int smallR2 = v / extraColSize;
            int smallC2 = v % extraColSize;
            int r = (stampRows * totalRows + smallR2) * cols + stampCols * totalCols + smallC2;
            System.out.printf("%d ", r + 1);
          }
        }
        System.out.println("");
      }
    }
  }
}