<?php

class Rectangle
{
    private $height;
    private $width;
    private $style;

    private $rectangle = [];

    public function __construct($height, $width, $style)
    {
        $this->height = $height;
        $this->width  = $width;
        $this->style  = $style;

        $this->rectangle = $this->make();
    }

    private function make()
    {
        $rectangle = [];
        for ($height = 0; $height < $this->height; $height++) {
            $rectangle[$height] = str_repeat($this->style, $this->width);
        }
        return $rectangle;
    }

    private function setColsInnerFrame($thickness, $style)
    {
        foreach ($this->rectangle as $height => $_) {
            for ($width = 0; $width < $thickness; $width++) {
                $this->rectangle[$height][$width]                = $style;
                $this->rectangle[$height][$this->width - $width] = $style;
            }
        }
    }

    private function setRowsInnerFrame($thickness, $style)
    {
        foreach ($this->rectangle as $height => $_) {
            if ($height >= $thickness) { return; }

            $this->rectangle[$height]                 = str_repeat($style, $this->width);
            $this->rectangle[$this->height - $height] = str_repeat($style, $this->width);
        }
    }

    public function setCheckerboardPattern($style = '#')
    {
        $checkLine = str_repeat($style.$this->style, ceil($this->width / 2));

        foreach ($this->rectangle as $height => $_) {
            $row = substr($checkLine, $height % 2, $this->width);
            $this->rectangle[$height] = $row;
        }

        return $this;
    }

    public function setInnerFrame($thickness = 1, $style = '#')
    {
        if ($thickness > $this->width) {
            $thickness = $this->width;
        }

        $this->setRowsInnerFrame($thickness, $style);
        $this->setColsInnerFrame($thickness, $style);

        return $this;
    }

    public function get()
    {
        return implode(PHP_EOL, $this->rectangle).PHP_EOL;
    }
}

class Main
{
    public function execute()
    {
        while (true) {
            list($height, $width) = $this->getStdinExplodedBy(' ');
            if ($this->invalid($height, $width)) { return; }

            $rectangle = (new Rectangle($height, $width, '.'))
                ->setCheckerboardPattern()
                ->get();

            $this->draw($rectangle);
        }
    }

    private function getStdinExplodedBy($delimiter)
    {
        return explode($delimiter, trim(fgets(STDIN)));
    }

    private function invalid($height, $width)
    {
        return $height == 0 && $width == 0;
    }

    public function draw($shape)
    {
        echo $shape, PHP_EOL;
    }
}

(new Main)->execute();