<?php
while (true) {
    
   list($height, $width) = getInputExplodeBySpaces();
    
    if ($height == 0 && $width == 0) {
       break;
    }
    
    $chessRectangle = new ChessRectangle($height, $width);
    echo $chessRectangle->drawChessRectangle(), PHP_EOL;
}

function getInputExplodeBySpaces()
{
    return explode(' ', trim(fgets(STDIN)));
}
 
class Rectangle
{
    public $height;
    public $width;
    public $output;
    public $hashSymbol  = '#';
    
    public function __construct($height, $width)
    {
        $this->height = $height;
        $this->width  = $width;
    }
    
    public function drawRectangle()
    {
        for ($i = 0; $i < $this->height; $i++) {
            $lines[] = $this->drawHashSymbolLine();
        }
        return $lines;
    }
    
    public function drawHashSymbolLine()
    {
        return str_repeat($this->hashSymbol, $this->width).PHP_EOL;
    }
}

class FrameRectangle extends Rectangle
{
    public $dotSymbol = '.';
    
    public function drawFrameRectangle()
    {
        for ($i = 0; $i < $this->height; $i++) {
            if ($i == 0 || ($i == $this->height - 1)) {
                $lines[] = $this->drawHashSymbolLine();
            } else {
                $lines[] = $this->drawMiddleLine();
            }
        }
        return $lines;
    }
    
    public function drawMiddleLine()
    {
         return $this->hashSymbol.str_repeat($this->dotSymbol, $this->width - 2).$this->hashSymbol.PHP_EOL;
    }
}

class ChessRectangle extends FrameRectangle
{
    public function drawChessRectangle()
    {
        for ($i = 0; $i < $this->height; $i++) {
            if ($i % 2 == 0) {
                $lines[] = $this->drawChessLine($this->dotSymbol, $this->hashSymbol);
            } else {
                $lines[] = $this->drawChessLine($this->hashSymbol, $this->dotSymbol);
            }
        }
        
        return implode($lines);
    }
    
    private function drawChessLine($firstSymbol, $secondSymbol)
    {
        for ($i = 0; $i < $this->width; $i++) {
            if ($i % 2 == 0) {
                $lines[] = $firstSymbol;
            } else {
                $lines[] = $secondSymbol;
            }
        }
         
        return implode($lines).PHP_EOL;
    }
}