This page is still under construction.

Parts of this page are still being built. What you see may change.

Bingo

Time limit1sMemory limit1024 MB

Summary
Given n and k, decide whether exactly k filled cells in an n x n grid can avoid completing any full row, column, or diagonal, and print such a grid.
Level

Medium5 of 10

Topics
Implementation, Greedy, Math, Brute force
Solved
No attempts yet

Problem

Bingo is a game played on a square grid. Each player gets an n×nn \times n grid and writes a distinct number in each cell. The host then draws a random number, and each player looks for that number on their grid and fills the corresponding cell if the number is present. This repeats until someone gets nn filled cells on a single line, which we call a bingo line.

There are 2n+22n + 2 possible bingo lines: nn horizontal lines, nn vertical lines, and 22 diagonal lines.

---  ...  ...  |..  .|.  ..|  \..  ../
...  ---  ...  |..  .|.  ..|  .\.  ./.
...  ...  ---  |..  .|.  ..|  ..\  /..

For example, the following grid has four bingo lines: two horizontal lines, one vertical line, and one diagonal line.

#..#.
#####
..###
#####
..###

When exactly is a bingo line formed? This is completely random. If you are lucky you can complete a line quite early, and on the other hand you can fill most of the grid without making any bingo line. In this problem we look at the unlucky case of filling kk cells without making any bingo line.

Given two integers nn and kk, determine whether it is possible to fill exactly kk cells of an n×nn \times n grid without making any bingo line. If it is possible, show one way to do it.

Input

The first and only line of input contains two integers, nn and kk.

Output

On the first line, output YES if it is possible to fill exactly kk cells of an n×nn \times n grid without making any bingo line. Otherwise, output NO.

If the answer is YES, output each row of the grid starting from the next line. Each row is a string of nn characters. The ii-th character is # (ASCII 35) if the ii-th cell of the row is filled, and . (ASCII 46) if it is not. Exactly kk cells must be filled, and there must be no bingo line.

If there are multiple ways to fill the grid, output any one of them.

Constraints

  • 1≤n≤1001 \leq n \leq 100
  • 0≤k≤n20 \leq k \leq n^2

Hint

The second example is valid only for subtasks 2 and 3.

Examples2

  1. Example 1

    Input
    4 2
    
    Expected output
    YES
    ##..
    ....
    ....
    ....
    
  2. Example 2

    Input
    4 16
    
    Expected output
    NO