In this challenge, you must implement part of a raster graphics editor that takes the coordinates of a circle and a square as input and draws them as filled-in shapes on a rectangular canvas.

The rectangular canvas consists of uniformly sized square pixels, and is $\boldsymbol{w}$ pixels wide, and $\mbox{h}$ pixels high. Each point on the canvas belongs to a pixel, the intersection of two pixels has zero area, and each pixel is completely contained within the canvas. 

The Cartesian coordinate system set up in the following way: 

Point $(0,0)$ is the center of the top-left pixel of the canvas.
Point $(w-1,0)$ is the center of the top-right pixel of the canvas.
Point $(0,h-1)$ is the center of the bottom-left pixel of the canvas. 
Point $(w-1,h-1)$ is the center of the bottom-right pixel of the canvas. 

Thus, all pixel centers have integer coordinates and if the center of a pixel has coordinates $(x_c,y_c)$, then point $(x,y)$ belongs to the pixel if and only if $x\in[x_c-0.5,x_c+0.5]$ and $y\in[y_c-0.5,y_c+0.5]$. The two shapes should be drawn like so:

The circle is centered at the integer coordinates $(x_{circle},y_{circle})$ and has non-negative integer radius $\textbf{r}$. A pixel should be black as a part of the circle if and only if the Euclidean distance from the pixel's center to the center of the circle is not greater than $\textbf{r}$.

The square is defined by the integer coordinates of two of its opposite corners $(x_{1},y_{1})$ and $(x_{3},y_{3})$. A pixel should be black as a part of the square if and only if its center falls within the square or along its border. The coordinates of different corners of the square do not coincide.

Given $\mbox{h}$, $\boldsymbol{w}$, and the definition of the circle and the square, print a raster image of the canvas where each character is either a . (denoting a white pixel outside of both shapes) or a # (denoting a black pixel that's part of a shape).

Note: The first pixel of the first line of output should correspond to the top-left corner of the canvas.

Input Format

The first line contains two space-separated integers describing the respective values of $\boldsymbol{w}$ (canvas width) and $\mbox{h}$ (canvas height). 

The second line contains three space-separated integers describing the respective values of $x_{circle}$, $y_{circle}$, and $\textbf{r}$ defining a circle with radius $\textbf{r}$ centered at $(x_{circle},y_{circle})$. 

The third line contains four space-separated integers describing the respective values of $x_{1},y_{1},x_{3},y_{3}$ defining a square with opposite corners at $(x_{1},y_{1})$ and $(x_{3},y_{3})$.

Constraints

$10\leq w,h\leq100$  
$-100\leq x_{circle},y_{circle},x_1,y_1,x_3,y_3\leq200$  
$0\leq r\leq100$  

Output Format

Print $\mbox{h}$ lines where each line contains $\boldsymbol{w}$ characters. Each character must be either a . (to denote a white pixel) or a # (to denote a black pixel). The first pixel of the first line of output corresponds to the top-left corner of the canvas.

Sample Input 0
20 16
9 6 5
16 14 8 14

Sample Output 0
....................
.........#..........
......#######.......
.....#########......
.....#########......
.....#########......
....###########.....
.....#########......
.....#########......
.....#########......
......#######.......
.........#.###......
..........#####.....
.........#######....
........#########...
.........#######....

Explanation 0

The canvas has $h=16$ rows and $\boldsymbol{w}={20}$ columns. The circle has radius $r=5$ and is centered at point $(9,6)$. The square has opposite corners located at points $(16,14)$ and $(8,14)$ and, as you can see, is rotated at an angle with its third corner at point $(12,10)$ (note that its fourth corner is outside the canvas boundary). In addition, the circle and the square overlap at point $(12,10)$.

Difficulty: MEDIUM

Solutions:
import sys
(w, h) = map(int, input().strip().split(' '))
(cx, cy, r) = map(int, input().strip().split(' '))
(x1, y1, x3, y3) = map(int, input().strip().split(' '))
sx = (x1 + x3) / 2
sy = (y1 + y3) / 2
(x1, y1, x3, y3) = (x1 - sx, y1 - sy, x3 - sx, y3 - sy)
(x2, y2) = (-y1, x1)
(x4, y4) = (y1, -x1)

def incircle(x, y):
	return (x - cx) ** 2 + (y - cy) ** 2 <= r ** 2

def insquare(x, y):
	x -= sx
	y -= sy
	return (x - x1) * (x2 - x1) + (y - y1) * (y2 - y1) >= 0 and (x - x2) * (x3 - x2) + (y - y2) * (y3 - y2) >= 0 and ((x - x3) * (x4 - x3) + (y - y3) * (y4 - y3) >= 0) and ((x - x4) * (x1 - x4) + (y - y4) * (y1 - y4) >= 0)
for y in range(h):
	for x in range(w):
		if incircle(x, y) or insquare(x, y):
			print('#', end='')
		else:
			print('.', end='')
	print()


import sys
(w, h) = map(int, input().split())
(cx, cy, r) = map(int, input().split())
(x1, y1, x3, y3) = map(int, input().split())

def insideCircle(cx, cy, r, x, y):
	return (cx - x) ** 2 + (cy - y) ** 2 <= r ** 2

def det(a, b, c, d):
	return a * d - b * c

def behind(x1, y1, x2, y2, x, y):
	return det(x - x1, y - y1, x2 - x1, y2 - y1) >= 0

def insideSquare(x1, y1, x3, y3, x, y):
	(ux, uy) = (x3 - x1, y3 - y1)
	(vx, vy) = (-uy, ux)
	(x2, y2) = (x1 + (ux + vx) / 2, y1 + (uy + vy) / 2)
	(x4, y4) = (x1 + (ux - vx) / 2, y1 + (uy - vy) / 2)
	return behind(x1, y1, x2, y2, x, y) and behind(x2, y2, x3, y3, x, y) and behind(x3, y3, x4, y4, x, y) and behind(x4, y4, x1, y1, x, y)
for y in range(h):
	for x in range(w):
		if insideCircle(cx, cy, r, x, y) or insideSquare(x1, y1, x3, y3, x, y):
			print('#', end='')
		else:
			print('.', end='')
	print()


import sys

def in_circle(x, y, cx, cy, r):
	return (x - cx) ** 2 + (y - cy) ** 2 <= r ** 2

def in_square(x, y, x1, y1, x3, y3):
	x13 = x3 - x1
	y13 = y3 - y1
	d = x13 ** 2 + y13 ** 2
	px = abs((2 * x - x1 - x3) * x13 + (2 * y - y1 - y3) * y13)
	py = abs((2 * x - x1 - x3) * y13 - (2 * y - y1 - y3) * x13)
	return px + py <= d
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
for y in range(h):
	row = ''.join(('#' if in_circle(x, y, circleX, circleY, r) or in_square(x, y, x1, y1, x3, y3) else '.' for x in range(w)))
	print(row)


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
(xc, yc) = ((x1 + x3) / 2, (y1 + y3) / 2)
(xd, yd) = ((x1 - x3) / 2, (y1 - y3) / 2)
(x2, y2) = (xc + yd, yc - xd)

def dot(x, y):
	((a, b), (c, d)) = (x, y)
	return a * c + b * d
res = [['.' for _ in range(w)] for _ in range(h)]
for i in range(h):
	for j in range(w):
		if (i - circleY) ** 2 + (j - circleX) ** 2 <= r ** 2:
			res[i][j] = '#'
		if 0 <= dot((j - x2, i - y2), (x1 - x2, y1 - y2)) <= dot((x1 - x2, y1 - y2), (x1 - x2, y1 - y2)):
			if 0 <= dot((j - x2, i - y2), (x3 - x2, y3 - y2)) <= dot((x3 - x2, y3 - y2), (x3 - x2, y3 - y2)):
				res[i][j] = '#'
for row in res:
	print(''.join(row))


import sys, math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def draw_circle(canvas, x_c, y_c, r):
	for (y, row) in enumerate(canvas):
		for x in range(len(row)):
			if (x - x_c) * (x - x_c) + (y - y_c) * (y - y_c) <= r * r:
				row[x] = '#'

def draw_square(canvas, x1, y1, x3, y3):
	xc = (x1 + x3) / 2
	yc = (y1 + y3) / 2
	xd = (x1 - x3) / 2
	yd = (y1 - y3) / 2
	x2 = xc - yd
	y2 = yc + xd
	edge_1_x = x1 - x2
	edge_1_y = x1 - x2
	edge_2_x = x3 - x2
	edge_2_y = x3 - x2
	edge_length_squared = edge_1_x * edge_1_x + edge_1_y * edge_1_y
	for (y, row) in enumerate(canvas):
		for x in range(len(row)):
			if 0 <= (x - x1) * (x2 - x1) + (y - y1) * (y2 - y1) <= (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) and 0 <= (x - x3) * (x2 - x3) + (y - y3) * (y2 - y3) <= (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3):
				row[x] = '#'
canvas = [list('.' * w) for _ in range(h)]
draw_circle(canvas, circleX, circleY, r)
draw_square(canvas, x1, y1, x3, y3)
for row in canvas:
	print(''.join(row))


(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
sy = (y1 + y3) / 2
sx = (x1 + x3) / 2
x2 = sx - (y1 - sy)
y2 = sy + (x1 - sx)
x4 = sx - (y3 - sy)
y4 = sy + (x3 - sx)
sy = [y1, y2, y3, y4, y1]
sx = [x1, x2, x3, x4, x1]
for y in range(h):
	s = ''
	for x in range(w):
		b = 1
		for i in range(4):
			if (y - sy[i]) * (sx[i + 1] - sx[i]) - (x - sx[i]) * (sy[i + 1] - sy[i]) < 0:
				b = 0
		if (y - circleY) ** 2 + (x - circleX) ** 2 <= r ** 2:
			b = 1
		s += '.#'[b]
	print(s)


(w, h) = [int(x) for x in input().strip().split()]
(xc, yc, r) = [int(x) for x in input().strip().split()]
(x1, y1, x3, y3) = [int(x) for x in input().strip().split()]
r = r * r + 1e-06
if x1 != x3 or y1 != y3:
	(xc2, yc2) = ((x1 + x3) / 2, (y1 + y3) / 2)
	(dx, dy) = (y3 - yc2, xc2 - x3)
	(x2, y2) = (xc2 + dx, yc2 + dy)
	(x4, y4) = (xc2 - dx, yc2 - dy)
	sqr = [(x2, y2), (x3, y3), (x4, y4), (x1, y1)]

	def get_pixel(x, y):
		if (x - xc) ** 2 + (y - yc) ** 2 < r:
			return '#'
		(xp, yp) = (x1 - x, y1 - y)
		for (xx, yy) in sqr:
			(xn, yn) = (xx - x, yy - y)
			if xp * yn - yp * xn < -1e-06:
				return '.'
			(xp, yp) = (xn, yn)
		return '#'
else:

	def get_pixel(x, y):
		if (x - xc) ** 2 + (y - yc) ** 2 < r or (x == x1 and y == y1):
			return '#'
		return '.'
for y in range(h):
	print(''.join((get_pixel(x, y) for x in range(w))))


def drawPixel(canvas, x, y, black=True):
	if 0 <= y < len(canvas) and 0 <= x < len(canvas[y]):
		canvas[y][x] = '#' if black else '.'

def drawCircle(canvas, xc, yc, r):
	for dx in range(-r, r + 1):
		for dy in range(-r, r + 1):
			if dx * dx + dy * dy <= r * r:
				drawPixel(canvas, xc + dx, yc + dy)

def drawSquare(canvas, x1, y1, x3, y3):
	(xc, yc) = ((x1 + x3) / 2, (y1 + y3) / 2)
	(x2, y2) = (xc + (y1 - yc), yc - (x1 - xc))
	(x4, y4) = (xc + (y3 - yc), yc - (x3 - xc))
	for x in range(int(min(x1, x2, x3, x4)), int(max(x1, x2, x3, x4) + 1.9)):
		for y in range(int(min(y1, y2, y3, y4)), int(max(y1, y2, y3, y4) + 1.9)):
			if (x2 - x1) * (y - y1) <= (y2 - y1) * (x - x1) and (x3 - x2) * (y - y2) <= (y3 - y2) * (x - x2) and ((x4 - x3) * (y - y3) <= (y4 - y3) * (x - x3)) and ((x1 - x4) * (y - y4) <= (y1 - y4) * (x - x4)):
				drawPixel(canvas, x, y)
(w, h) = map(int, input().split())
(xc, yc, r) = map(int, input().split())
(x1, y1, x3, y3) = map(int, input().split())
canvas = [['.'] * w for _ in range(h)]
drawCircle(canvas, xc, yc, r)
drawSquare(canvas, x1, y1, x3, y3)
print('\n'.join(map(''.join, canvas)))


from math import sqrt

def area(x1, y1, x2, y2, x3, y3):
	A = sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
	B = sqrt((x1 - x3) ** 2 + (y1 - y3) ** 2)
	C = sqrt((x2 - x3) ** 2 + (y2 - y3) ** 2)
	S = (A + B + C) / 2
	return sqrt(abs(S * (S - A) * (S - B) * (S - C)))

def in_circle(x, y, xc, yc, r):
	if (x - xc) * (x - xc) + (y - yc) * (y - yc) <= r * r:
		return True
	return False

def in_square(x, y, x1, y1, x3, y3):
	asq = ((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3)) / 2
	xc = (x1 + x3) / 2
	yc = (y1 + y3) / 2
	x2 = xc + (y1 - y3) / 2
	y2 = yc + (x3 - x1) / 2
	x4 = xc - (y1 - y3) / 2
	y4 = yc - (x3 - x1) / 2
	totarea = area(x, y, x1, y1, x2, y2) + area(x, y, x1, y1, x4, y4) + area(x, y, x2, y2, x3, y3) + area(x, y, x3, y3, x4, y4)
	if abs(totarea - asq) <= 1e-05:
		return True
	return False
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
for y in range(h):
	for x in range(w):
		if in_circle(x, y, circleX, circleY, r) or in_square(x, y, x1, y1, x3, y3):
			print('#', end='')
		else:
			print('.', end='')
	print()


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
mx = (x1 + x3) / 2
my = (y1 + y3) / 2
xt = (y3 - y1) / 2
yt = (x1 - x3) / 2
x2 = mx + xt
y2 = my + yt
x4 = mx - xt
y4 = my - yt
matrix = [['.'] * w for _ in range(h)]
for x in range(w):
	for y in range(h):
		if (x - circleX) ** 2 + (y - circleY) ** 2 <= r ** 2:
			matrix[y][x] = '#'
		if 0 <= (x - x1) * (x2 - x1) + (y - y1) * (y2 - y1) <= (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) and 0 <= (x - x1) * (x4 - x1) + (y - y1) * (y4 - y1) <= (x4 - x1) * (x4 - x1) + (y4 - y1) * (y4 - y1):
			matrix[y][x] = '#'
for l in matrix:
	print(''.join(l))


import sys
(width, height) = tuple((int(x) for x in sys.stdin.readline().split()))
(cx, cy, cr) = tuple((int(x) for x in sys.stdin.readline().split()))
cr_sq = cr * cr
(x1, y1, x3, y3) = tuple((int(x) for x in sys.stdin.readline().split()))
sq_center_x = (x1 + x3) / 2
sq_center_y = (y1 + y3) / 2
sq_diag_x = (x3 - x1) / 2
sq_diag_y = (y3 - y1) / 2
x2 = sq_center_x + sq_diag_y
y2 = sq_center_y - sq_diag_x
x4 = sq_center_x - sq_diag_y
y4 = sq_center_y + sq_diag_x
v12x = x2 - x1
v12y = y2 - y1
v14x = x4 - x1
v14y = y4 - y1
v32x = x2 - x3
v32y = y2 - y3
v34x = x4 - x3
v34y = y4 - y3

def in_circle(x, y):
	dx = x - cx
	dy = y - cy
	norm_sq = dx * dx + dy * dy
	return norm_sq <= cr_sq

def det(vax, vay, vbx, vby):
	return vax * vby - vbx * vay

def in_square(x, y):
	v1x = x - x1
	v1y = y - y1
	if det(v12x, v12y, v1x, v1y) < 0:
		return False
	if det(v14x, v14y, v1x, v1y) > 0:
		return False
	v3x = x - x3
	v3y = y - y3
	if det(v32x, v32y, v3x, v3y) > 0:
		return False
	if det(v34x, v34y, v3x, v3y) < 0:
		return False
	return True
for y in range(height):
	for x in range(width):
		if in_circle(x, y):
			sys.stdout.write('#')
		elif in_square(x, y):
			sys.stdout.write('#')
		else:
			sys.stdout.write('.')
	sys.stdout.write('\n')


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
board = [['.' for _ in range(w)] for _ in range(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
for i in range(h):
	for j in range(w):
		if (i - circleY) ** 2 + (j - circleX) ** 2 <= r ** 2:
			board[i][j] = '#'
		ay = i - y1
		ax = j - x1
		by = i - y3
		bx = j - x3
		cy = y3 - y1
		cx = x3 - x1
		dot1 = ax * cx + ay * cy
		dot2 = bx * cx + by * cy
		if dot1 >= 0 and 2 * (dot1 * dot1) >= (cx * cx + cy * cy) * (ax * ax + ay * ay) and (dot2 <= 0) and (2 * (dot2 * dot2) >= (cx * cx + cy * cy) * (bx * bx + by * by)) or (dot1 >= 0 and 2 * (dot1 * dot1) >= (cx * cx + cy * cy) * (ax * ax + ay * ay) and (dot2 <= 0) and (2 * (dot2 * dot2) >= (cx * cx + cy * cy) * (bx * bx + by * by))):
			board[i][j] = '#'
	print(*board[i], sep='')


import math

def isRightTurn(x1, y1, x2, y2, x3, y3):
	return (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
grid = [[False for i in range(w)] for j in range(h)]
diagXDiff = x3 - x1
diagYDiff = y3 - y1
if diagXDiff == 0:
	x2 = x1 - diagYDiff / 2
	x4 = x1 + diagYDiff / 2
	y2 = y1 + diagYDiff / 2
	y4 = y1 + diagYDiff / 2
else:
	if diagXDiff < 0:
		adjDiff1 = 1 - diagYDiff / diagXDiff
		adjDiff2 = 1 + diagYDiff / diagXDiff
	else:
		adjDiff1 = diagYDiff / diagXDiff - 1
		adjDiff2 = -1 - diagYDiff / diagXDiff
	totalDiff = math.sqrt(adjDiff1 * adjDiff1 + adjDiff2 * adjDiff2)
	length = math.sqrt(diagXDiff * diagXDiff + diagYDiff * diagYDiff) / math.sqrt(2)
	x2 = x1 - length * adjDiff1 / totalDiff
	y2 = y1 - length * adjDiff2 / totalDiff
	x4 = x1 - length * adjDiff2 / totalDiff
	y4 = y1 + length * adjDiff1 / totalDiff
for gridX in range(w):
	for gridY in range(h):
		circleDiffX = circleX - gridX
		circleDiffY = circleY - gridY
		if circleDiffX * circleDiffX + circleDiffY * circleDiffY <= r * r:
			grid[gridY][gridX] = True
		rightTurn1 = isRightTurn(x1, y1, x2, y2, gridX, gridY)
		rightTurn2 = isRightTurn(x2, y2, x3, y3, gridX, gridY)
		rightTurn3 = isRightTurn(x3, y3, x4, y4, gridX, gridY)
		rightTurn4 = isRightTurn(x4, y4, x1, y1, gridX, gridY)
		eps = 1e-06
		if rightTurn1 <= eps and rightTurn2 <= eps and (rightTurn3 <= eps) and (rightTurn4 <= eps):
			grid[gridY][gridX] = True
		elif rightTurn1 >= -eps and rightTurn2 >= -eps and (rightTurn3 >= -eps) and (rightTurn4 >= -eps):
			grid[gridY][gridX] = True
for gridY in range(h):
	for gridX in range(w):
		if grid[gridY][gridX]:
			print('#', end='')
		else:
			print('.', end='')
	print()


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
sq = lambda x: x * x
sqrt = lambda x: pow(x, 0.5)
x2 = (x1 + y1 + x3 - y3) / 2
y2 = (-x1 + y1 + x3 + y3) / 2
x4 = (x1 - y1 + x3 + y3) / 2
y4 = (x1 + y1 - x3 + y3) / 2
square_area = 0.5 * (sq(x3 - x1) + sq(y3 - y1))

def traingle_area(x1, y1, x2, y2, x3, y3):
	if (y2 - y1) * (x3 - x1) == (y3 - y1) * (x2 - x1):
		return 0.0
	a = sqrt(sq(x1 - x2) + sq(y1 - y2))
	b = sqrt(sq(x1 - x3) + sq(y1 - y3))
	c = sqrt(sq(x2 - x3) + sq(y2 - y3))
	p = (a + b + c) / 2
	return round(sqrt(p * (p - a) * (p - b) * (p - c)), 6)

def within_circle(x, y):
	return sq(x - circleX) + sq(y - circleY) <= sq(r)

def within_square(x, y):
	a1 = traingle_area(x, y, x1, y1, x2, y2)
	a2 = traingle_area(x, y, x2, y2, x3, y3)
	a3 = traingle_area(x, y, x3, y3, x4, y4)
	a4 = traingle_area(x, y, x4, y4, x1, y1)
	return a1 + a2 + a3 + a4 <= square_area
for i in range(h):
	s = ''
	for j in range(w):
		if within_circle(j, i) or within_square(j, i):
			s += '#'
		else:
			s += '.'
	print(s)


(w, h) = map(int, input().split())
(circleX, circleY, r) = map(int, input().split())
(x1, y1, x3, y3) = map(int, input().split())
dy = y3 - y1
dx = x3 - x1
cy = (y3 + y1) / 2
cx = (x3 + x1) / 2
two_sq_area = dx * dx + dy * dy
x2 = cx - dy / 2
y2 = cy + dx / 2
x4 = cx + dy / 2
y4 = cy - dx / 2

def two_tri_area(a1, b1, a2, b2, a3, b3):
	return abs(a1 * (b2 - b3) + a2 * (b3 - b1) + a3 * (b1 - b2))

def insquare(x, y):
	return two_tri_area(x, y, x1, y1, x2, y2) + two_tri_area(x, y, x2, y2, x3, y3) + two_tri_area(x, y, x3, y3, x4, y4) + two_tri_area(x, y, x4, y4, x1, y1) <= two_sq_area + 0.5
res = tuple((['.'] * w for _ in range(h)))
rsq = r * r
for y in range(h):
	dyc = y - circleY
	xsqmax = rsq - dyc * dyc
	for x in range(w):
		dxc = x - circleX
		if dxc * dxc <= xsqmax or insquare(x, y):
			res[y][x] = '#'
print('\n'.join((''.join(row) for row in res)))


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
r2 = r * r
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
(vecx, vecy) = [(x3 - x1) / 2, (y3 - y1) / 2]
(rpx, rpy) = [x1 + vecx, y1 + vecy]
(x2, y2, x4, y4) = [rpx - vecy, rpy + vecx, rpx + vecy, rpy - vecx]

def dotpr(x, y):
	return x[0] * y[0] + x[1] * y[1]
vec12 = (x2 - x1, y2 - y1)
vec14 = (x4 - x1, y4 - y1)
vec12sqr = dotpr(vec12, vec12)
vec14sqr = dotpr(vec14, vec14)
for y in range(h):
	for x in range(w):
		char = '.'
		if (circleX - x) * (circleX - x) + (circleY - y) * (circleY - y) <= r2:
			char = '#'
		else:
			vec1p = (x - x1, y - y1)
			if 0 <= dotpr(vec1p, vec12) <= vec12sqr and 0 <= dotpr(vec1p, vec14) <= vec14sqr:
				char = '#'
		sys.stdout.write(char)
	print('')


import sys
import math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
(x2, y2) = ((x1 + x3 + y3 - y1) / 2, (y1 + y3 + x1 - x3) / 2)
(x4, y4) = ((x1 + x3 + y1 - y3) / 2, (y1 + y3 + x3 - x1) / 2)
Tarea = ((x1 - x3) ** 2 + (y1 - y3) ** 2) / 2

def area(x1, y1, x2, y2, x3, y3):
	return abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)))
for i in range(h):
	row = ''
	for j in range(w):
		Cdis = math.sqrt((j - circleX) ** 2 + (i - circleY) ** 2)
		if Cdis <= r:
			row = row + '#'
		elif area(j, i, x1, y1, x2, y2) + area(j, i, x2, y2, x3, y3) + area(j, i, x3, y3, x4, y4) + area(j, i, x1, y1, x4, y4) == Tarea:
			row = row + '#'
		else:
			row = row + '.'
	print(row)


__author__ = 'Ward'
import sys
(W, H) = map(int, sys.stdin.readline().split())
(Xc, Yc, R) = map(int, sys.stdin.readline().split())
(X1, Y1, X2, Y2) = map(int, sys.stdin.readline().split())
R2 = R ** 2
Canvas = [['.' for i in range(0, W)] for y in range(0, H)]
a1 = Y1 - Y2 + X1 - X2
b1 = -X1 + X2 + Y1 - Y2
a2 = -b1
b2 = a1
c1 = a1 * X1 + b1 * Y1
c2 = a2 * X1 + b2 * Y1
c3 = a1 * X2 + b1 * Y2
c4 = a2 * X2 + b2 * Y2
for X in range(0, W):
	for Y in range(0, H):
		if (X - Xc) ** 2 + (Y - Yc) ** 2 <= R2:
			Canvas[Y][X] = '#'
		else:
			A = X * a1 + Y * b1
			B = X * a2 + Y * b2
			if A > c1 and A > c3:
				continue
			if A < c1 and A < c3:
				continue
			if B > c2 and B > c4:
				continue
			if B < c2 and B < c4:
				continue
			Canvas[Y][X] = '#'
for List in Canvas:
	print(''.join(List))


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(xc, yc, r) = input().strip().split(' ')
(xc, yc, r) = [int(xc), int(yc), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
table = [['.' for i in range(w)] for j in range(h)]
for y in range(h):
	for x in range(w):
		k = ((xc - x) ** 2 + (yc - y) ** 2) ** 0.5
		if k <= r:
			table[y][x] = '#'
		else:
			xc1 = (x1 + x3) / 2
			yc1 = (y1 + y3) / 2
			xd = (x1 - x3) / 2
			yd = (y1 - y3) / 2
			x2 = xc1 - yd
			y2 = yc1 + xd
			x4 = xc1 + yd
			y4 = yc1 - xd
			area = (x2 - x1) ** 2 + (y2 - y1) ** 2
			lisx = [(x1, y1), (x2, y2), (x3, y3), (x4, y4), (x1, y1)]
			lisa = []
			for i in range(len(lisx) - 1):
				(a1, b1) = lisx[i]
				(a2, b2) = lisx[i + 1]
				m = abs(0.5 * (a1 * (b2 - y) + a2 * (y - b1) + x * (b1 - b2)))
				lisa.append(m)
			sum1 = sum(lisa)
			if sum1 == area:
				table[y][x] = '#'
for i in range(h):
	lisf = []
	for j in range(w):
		lisf.append(table[i][j])
	print(''.join(lisf))


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
import math

def inCircle(x, y):
	d = math.hypot(x - circleX, y - circleY)
	return d <= r

def distance(x, y, xi1, yi1, xi2, yi2):
	uX = x - xi1
	uY = y - yi1
	vX = xi2 - xi1
	vY = yi2 - yi1
	dot = uX * vX + uY * vY
	norm2 = vX * vX + vY * vY
	wX = vX * (1 - dot / norm2)
	wY = vY * (1 - dot / norm2)
	return math.hypot(wX, wY)

def inSquare(x, y):
	mX = (x1 + x3) / 2
	mY = (y1 + y3) / 2
	x2 = mX + (mY - y1)
	y2 = mY - (mX - x1)
	l = math.hypot(x1 - x2, y1 - y2)
	x4 = mX - (mY - y1)
	y4 = mY + (mX - x1)
	return distance(x, y, x1, y1, x2, y2) <= l and distance(x, y, x2, y2, x3, y3) <= l and (distance(x, y, x3, y3, x4, y4) <= l) and (distance(x, y, x4, y4, x1, y1) <= l)

def square():
	mX = (x1 + x3) / 2
	mY = (y1 + y3) / 2
	x2 = mX + (mY - y1)
	y2 = mY - (mX - x1)
	x4 = mX - (mY - y1)
	y4 = mY + (mX - x1)
square()
for y in range(h):
	l = ''
	for x in range(w):
		if inCircle(x, y) or inSquare(x, y):
			l += '#'
		else:
			l += '.'
	print(l)


(w, h) = map(int, input().split())
(xc, yc, r) = map(int, input().split())
(x1, y1, x3, y3) = map(int, input().split())
x2 = (x1 + x3 + y3 - y1) / 2
y2 = (y1 + y3 + x1 - x3) / 2
x4 = (x1 + x3 + y1 - y3) / 2
y4 = (y1 + y3 + x3 - x1) / 2
ab = [x2 - x1, y2 - y1]
bc = [x3 - x2, y3 - y2]

def dot(p, q):
	return p[0] * q[0] + q[1] * p[1]
dab = dot(ab, ab)
dbc = dot(bc, bc)

def inr(x, y):
	am = [x - x1, y - y1]
	t = dot(ab, am)
	if t < 0 or t > dab:
		return False
	bm = [x - x2, y - y2]
	t = dot(bc, bm)
	if t < 0 or t > dbc:
		return False
	return True

def inc(x, y):
	if (x - xc) ** 2 + (y - yc) ** 2 <= r * r:
		return True
	else:
		return False
for y in range(h):
	for x in range(w):
		c = '.'
		if inc(x, y) or inr(x, y):
			c = '#'
		print(c, end='', sep='')
	print()


import sys
from math import sqrt
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def mag2(v):
	return sum([v[i] * v[i] for i in range(len(v))])

def dot(a, b):
	return sum([a[i] * b[i] for i in range(len(b))])

def in_circle(x, y):
	return (circleX - x) * (circleX - x) + (circleY - y) * (circleY - y) <= r * r

def in_square(x, y):
	if (x, y) in [(x1, y1), (x3, y3)]:
		return True
	v1 = ((x3 - x1) / 2, (y3 - y1) / 2)
	v = (x - x1, y - y1)
	d = dot(v1, v)
	a = d / sqrt(mag2(v1) * mag2(v))
	if 1 / sqrt(2) <= a <= 1 and 0 <= d <= mag2(v1):
		return True
	v = (x - x3, y - y3)
	v1 = (-(x3 - x1) / 2, -(y3 - y1) / 2)
	d = dot(v1, v)
	a = d / sqrt(mag2(v1) * mag2(v))
	if 1 / sqrt(2) <= a <= 1 and 0 <= d <= mag2(v1):
		return True
	return False
for j in range(h):
	for i in range(w):
		print('#' if in_circle(i, j) or in_square(i, j) else '.', end='')
	print('')


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def new_canvas(w, h):
	canvas = [['.'] * w for i in range(h)]
	return canvas

def print_canvas(canvas):
	for r in canvas:
		print(''.join(r))

def fill_circle(canvas, xc, yc, r):
	r2 = r ** 2
	for y in range(yc - r - 1, yc + r + 1):
		for x in range(xc - r - 1, xc + r + 1):
			if x >= 0 and x < w and (y >= 0) and (y < h):
				rr2 = (x - xc) ** 2 + (y - yc) ** 2
				if rr2 <= r2:
					canvas[y][x] = '#'

def crossp(v1x, v1y, v2x, v2y):
	return v1x * v2y - v1y * v2x

def fill_tri_bc(canvas, v1x, v1y, v2x, v2y, v3x, v3y):
	vs1x = v2x - v1x
	vs1y = v2y - v1y
	vs2x = v3x - v1x
	vs2y = v3y - v1y
	cpvs1vs2 = crossp(vs1x, vs1y, vs2x, vs2y)
	for y in range(int(min(v1y, v2y, v3y)) - 1, int(max(v1y, v2y, v3y)) + 1):
		for x in range(int(min(v1x, v2x, v3x)) - 1, int(max(v1x, v2x, v3x)) + 1):
			if x >= 0 and x < w and (y >= 0) and (y < h):
				qx = x - v1x
				qy = y - v1y
				s = crossp(qx, qy, vs2x, vs2y) / cpvs1vs2
				t = crossp(vs1x, vs1y, qx, qy) / cpvs1vs2
				if s >= 0 and t >= 0 and (s + t <= 1):
					canvas[y][x] = '#'

def fill_square(canvas, x1, y1, x3, y3):
	xc = (x1 + x3) / 2
	yc = (y1 + y3) / 2
	xd = (x1 - x3) / 2
	yd = (y1 - y3) / 2
	x2 = xc - yd
	y2 = yc + xd
	x4 = xc + yd
	y4 = yc - xd
	fill_tri_bc(canvas, x1, y1, x2, y2, x3, y3)
	fill_tri_bc(canvas, x1, y1, x3, y3, x4, y4)
canvas = new_canvas(w, h)
fill_circle(canvas, circleX, circleY, r)
fill_square(canvas, x1, y1, x3, y3)
print_canvas(canvas)


import sys

def triangle(xa, ya, xb, yb, xc, yc):
	return abs(xa * yb + xb * yc + xc * ya - xa * yc - xc * yb - xb * ya)

def in_square(x, y, p, area):
	(x1, y1, x2, y2, x3, y3, x4, y4) = p
	a12 = triangle(x1, y1, x2, y2, x, y)
	a23 = triangle(x2, y2, x3, y3, x, y)
	a34 = triangle(x3, y3, x4, y4, x, y)
	a41 = triangle(x4, y4, x1, y1, x, y)
	if 2 * area == a12 + a23 + a34 + a41:
		return 1
	return 0
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
circleX += 0.5
circleY += 0.5
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
array = [['.' for x in range(w)] for y in range(h)]
diagx = (x3 - x1) / 2
diagy = (y3 - y1) / 2
xc = (x3 + x1) / 2
yc = (y3 + y1) / 2
x2 = xc - diagy
y2 = yc + diagx
x4 = xc + diagy
y4 = yc - diagx
p = [x1 + 0.5, y1 + 0.5, x2 + 0.5, y2 + 0.5, x3 + 0.5, y3 + 0.5, x4 + 0.5, y4 + 0.5]
area = 2 * (diagx ** 2 + diagy ** 2)
for j in range(h):
	line = array[j]
	for i in range(w):
		x = i + 0.5
		y = j + 0.5
		if (x - circleX) ** 2 + (y - circleY) ** 2 <= r * r:
			line[i] = '#'
		elif in_square(x, y, p, area):
			line[i] = '#'
for i in range(h):
	print(''.join(array[i]))


import sys
import math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def distance(a, b, x, y):
	return math.sqrt(math.pow(a - x, 2) + math.pow(b - y, 2))

def dot(linea, lineb):
	return linea[0] * lineb[0] + linea[1] * lineb[1]

def insideSquare(linew, lineh, linetodot):
	inw = dot(linetodot, linew) >= 0 and dot(linetodot, linew) <= dot(linew, linew)
	inh = dot(linetodot, lineh) >= 0 and dot(linetodot, lineh) <= dot(lineh, lineh)
	return inw and inh
mat = [['.'] * w for i in range(h)]
for y in range(h):
	for x in range(w):
		if distance(x, y, circleX, circleY) <= r:
			mat[y][x] = '#'
deltax = x3 - x1
deltay = y3 - y1
(x2, y2) = ((x1 + x3 + y3 - y1) / 2, (y1 + y3 + x1 - x3) / 2)
(x3, y3) = ((x1 + x3 + y1 - y3) / 2, (y1 + y3 + x3 - x1) / 2)
for y in range(h):
	for x in range(w):
		linew = [x1 - x2, y1 - y2]
		lineh = [x1 - x3, y1 - y3]
		linetodot = [x1 - x, y1 - y]
		if insideSquare(linew, lineh, linetodot):
			mat[y][x] = '#'
for line in mat:
	print(''.join(line))


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
z1 = x3 + y3 - x1 - y1
z2 = x1 + y3 - y1 - x3
z = z1 * z1 + z2 * z2
r2 = r * r
for y in range(h):
	for x in range(w):
		if (x - circleX) ** 2 + (y - circleY) ** 2 <= r2 or (0 <= 2 * (z1 * (x - x1) + z2 * (y - y1)) <= z and 0 <= 2 * (-z2 * (x - x1) + z1 * (y - y1)) <= z):
			print('#', end='')
		else:
			print('.', end='')
	print()


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]

def signt(p1, p2, p3):
	return (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1])

def pint(pt, v1, v2, v3):
	b1 = signt(pt, v1, v2) < 0
	b2 = signt(pt, v2, v3) < 0
	b3 = signt(pt, v3, v1) < 0
	return b1 == b2 and b2 == b3

def is_circle(x, y):
	return (circleX - x) * (circleX - x) + (circleY - y) * (circleY - y) <= r * r

def signm(v):
	if v >= 0:
		return 1
	else:
		return -1
(x1, y1, x2, y2) = input().strip().split(' ')
(x1, y1, x2, y2) = [int(x1), int(y1), int(x2), int(y2)]
m = 0.50000000001
v1 = (0.5 * (x1 + x2) + m * abs(y1 - y2), 0.5 * (y1 + y2) + signm(y2 - y1) * m * (x1 - x2))
v2 = (0.5 * (x1 + x2) - m * abs(y1 - y2), 0.5 * (y1 + y2) - signm(y2 - y1) * m * (x1 - x2))

def is_square(x, y):
	if pint((x, y), v1, (x1, y1), (x2, y2)):
		return True
	if pint((x, y), v2, (x1, y1), (x2, y2)):
		return True
	return False
for y in range(h):
	l = ['#' if is_circle(x, y) or is_square(x, y) else '.' for x in range(w)]
	print(''.join(map(str, l)))


import sys
import math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
ang = math.radians(45)
x2t = x3 - x1
y2t = y3 - y1
x2 = x2t * math.cos(ang) - y2t * math.sin(ang)
x2 /= math.sqrt(2)
x2 += x1
y2 = y2t * math.cos(ang) + x2t * math.sin(ang)
y2 /= math.sqrt(2)
y2 += y1
ang = math.radians(-45)
x4t = x3 - x1
y4t = y3 - y1
x4 = x4t * math.cos(ang) - y4t * math.sin(ang)
x4 /= math.sqrt(2)
x4 += x1
y4 = y4t * math.cos(ang) + x4t * math.sin(ang)
y4 /= math.sqrt(2)
y4 += y1
precisionError = 10 ** (-10)

def isCircle(x, y):
	if math.sqrt((x - circleX) ** 2 + (y - circleY) ** 2) <= r + precisionError:
		return True
	else:
		return False

def isSquare(x, y):
	if (x2 - x1) * (y - y1) - (y2 - y1) * (x - x1) <= 0 + precisionError and (x3 - x2) * (y - y2) - (y3 - y2) * (x - x2) <= 0 + precisionError and ((x4 - x3) * (y - y3) - (y4 - y3) * (x - x3) <= 0 + precisionError) and ((x1 - x4) * (y - y4) - (y1 - y4) * (x - x4) <= 0 + precisionError):
		return True
	else:
		return False
for y in range(h):
	for x in range(w):
		if isCircle(x, y) or isSquare(x, y):
			print('#', end='')
		else:
			print('.', end='')
	print('')


(x1, y1, x3, y3) = (16, 14, 8, 14)
import math

def putpixel(x, y):
	try:
		grid[y][x] = '#'
	except:
		pass

def vmul(v, a):
	return [x * a for x in v]

def vdiv(v, a):
	return [x // a for x in v]

def add(x, y):
	return [u + v for (u, v) in zip(x, y)]

def sub(x, y):
	return [u - v for (u, v) in zip(x, y)]

def norm_sqr(v):
	return sum((x * x for x in v))

def dist_sqr(u, v):
	return norm_sqr(sub(u, v))

def cross(u, v):
	return u[0] * v[1] - v[0] * u[1]

def classify(p, p1, p2):
	d2 = sub(p2, p1)
	d = sub(p, p1)
	return cross(d, d2) >= 0

def all_same(v):
	test = v[0]
	for x in v:
		if x != test:
			return False
	return True

def rect(x1, y1, x3, y3):
	p1 = (x1, y1)
	p3 = (x3, y3)
	(u, v) = sub(p3, p1)
	p1_2 = vmul(p1, 2)
	p3_2 = vmul(p3, 2)
	p2_2 = add((u - v, u + v), p1_2)
	p4_2 = add((u + v, -u + v), p1_2)
	for x in range(w):
		for y in range(h):
			p = (x * 2, y * 2)
			ori = [classify(p, p1_2, p2_2), classify(p, p2_2, p3_2), classify(p, p3_2, p4_2), classify(p, p4_2, p1_2)]
			if all_same(ori):
				putpixel(x, y)

def circle(x0, y0, radius):
	c = (x0, y0)
	r2 = radius * radius
	for x in range(w):
		for y in range(h):
			p = (x, y)
			if dist_sqr(p, c) <= r2:
				putpixel(x, y)
if 1:
	(w, h) = input().strip().split(' ')
	(w, h) = [int(w), int(h)]
	(circleX, circleY, r) = input().strip().split(' ')
	(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
	(x1, y1, x3, y3) = input().strip().split(' ')
	(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
else:
	(w, h) = (20, 16)
	(circleX, circleY, r) = (9, 6, 5)
	(x1, y1, x3, y3) = (16, 14, 8, 14)
grid = [['.' for _ in range(w)] for _ in range(h)]
rect(x1, y1, x3, y3)
circle(circleX, circleY, r)

def line_joiner(line):
	return ''.join(line)
res = '\n'.join(map(line_joiner, grid))
print(res)


from math import sqrt
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
xc = (x1 + x3) / 2
yc = (y1 + y3) / 2
xd = (x1 - x3) / 2
yd = (y1 - y3) / 2
x2 = xc - yd
y2 = yc + xd
x4 = xc + yd
y4 = yc - xd
area_square = (x2 - x1) ** 2 + (y2 - y1) ** 2

def within_circle(x, y, r, a, b):
	if (a - x) ** 2 + (b - y) ** 2 <= r ** 2:
		return True
	else:
		return False

def triangle_area(x1, y1, x2, y2, x3, y3):
	result = abs(1 / 2 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)))
	return result

def within_triangle(x1, y1, x2, y2, x3, y3, x4, y4, a, b):
	APD = triangle_area(x1, y1, x2, y2, a, b)
	DPC = triangle_area(x2, y2, x3, y3, a, b)
	CPB = triangle_area(x3, y3, x4, y4, a, b)
	PBA = triangle_area(x4, y4, x1, y1, a, b)
	area_triangles = sum([APD, DPC, CPB, PBA])
	if area_triangles > area_square:
		return False
	else:
		return True
for b in range(h):
	for a in range(w):
		if any((within_circle(circleX, circleY, r, a, b), within_triangle(x1, y1, x2, y2, x3, y3, x4, y4, a, b))):
			print('#', end='', sep='')
		else:
			print('.', end='', sep='')
	print('')


import sys
import math

def cross(X):
	return (-X[1], X[0])

def dot(X, Y):
	return X[0] * Y[0] + X[1] * Y[1]

def len2(X):
	return X[0] ** 2 + X[1] ** 2

def dist2(X, Y):
	return len2((X[0] - Y[0], X[1] - Y[1]))

def add(X, Y):
	return (X[0] + Y[0], X[1] + Y[1])

def diff(X, Y):
	return (X[0] - Y[0], X[1] - Y[1])

def cmult(X, c):
	return (X[0] * c, X[1] * c)
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
cX = (circleX, circleY)
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [float(x1), float(y1), float(x3), float(y3)]
p1 = (x1, y1)
p3 = (x3, y3)
pC = cmult(add(p1, p3), 1 / 2)
p2 = add(cross(diff(p3, pC)), pC)
p4 = diff(pC, diff(p2, pC))
n1 = cross(diff(p2, p1))
n2 = cross(diff(p3, p2))
n3 = cross(diff(p4, p3))
n4 = cross(diff(p1, p4))
d1 = dot(n1, p1)
d2 = dot(n2, p2)
d3 = dot(n3, p3)
d4 = dot(n4, p4)
N = [n1, n2, n3, n4]
D = [d1, d2, d3, d4]

def insideSQ(X):
	for i in range(4):
		if dot(N[i], X) > D[i]:
			return False
	return True
r2 = r ** 2

def insideC(X):
	return dist2(X, cX) <= r2
pix = [[0] * w for _ in range(h)]
for x in range(w):
	for y in range(h):
		pos = (x, y)
		if insideC(pos) or insideSQ(pos):
			pix[y][x] = 1

def tran(bi):
	if bi == 0:
		return '.'
	else:
		return '#'
for y in range(h):
	out = [tran(p) for p in pix[y]]
	print(*out, sep='')


import sys, math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
sx = x1 - (x1 - x3) / 2
sy = y1 - (y1 - y3) / 2
x2 = sx + (y1 - y3) / 2
y2 = sy - (x1 - x3) / 2
x4 = sx - (y1 - y3) / 2
y4 = sy + (x1 - x3) / 2
tx1 = x1 - (x1 - sx) / 2
ty1 = y1 - (y1 - sy) / 2
tx2 = x3 - (x3 - sx) / 2
ty2 = y3 - (y3 - sy) / 2
p1 = (y1 - y2) * tx1 + (x2 - x1) * ty1 + (x1 * y2 - y1 * x2)
p2 = (y1 - y4) * tx1 + (x4 - x1) * ty1 + (x1 * y4 - y1 * x4)
p3 = (y4 - y2) * tx1 + (x2 - x4) * ty1 + (x4 * y2 - y4 * x2)
p4 = (y3 - y2) * tx2 + (x2 - x3) * ty2 + (x3 * y2 - y3 * x2)
p5 = (y3 - y4) * tx2 + (x4 - x3) * ty2 + (x3 * y4 - y3 * x4)
p6 = (y4 - y2) * tx2 + (x2 - x4) * ty2 + (x4 * y2 - y4 * x2)
for b in range(h):
	line = ''
	for a in range(w):
		if math.sqrt((a - circleX) ** 2 + (b - circleY) ** 2) <= r:
			line = line + '#'
		elif p1 * ((y1 - y2) * a + (x2 - x1) * b + (x1 * y2 - y1 * x2)) >= 0 and p2 * ((y1 - y4) * a + (x4 - x1) * b + (x1 * y4 - y1 * x4)) >= 0 and (p3 * ((y4 - y2) * a + (x2 - x4) * b + (x4 * y2 - y4 * x2)) >= 0):
			line = line + '#'
		elif p4 * ((y3 - y2) * a + (x2 - x3) * b + (x3 * y2 - y3 * x2)) >= 0 and p5 * ((y3 - y4) * a + (x4 - x3) * b + (x3 * y4 - y3 * x4)) >= 0 and (p6 * ((y4 - y2) * a + (x2 - x4) * b + (x4 * y2 - y4 * x2)) >= 0):
			line = line + '#'
		else:
			line = line + '.'
	print(line)


import sys

def area(x1, x2, x3, y1, y2, y3):
	A = x1 * y2 + x2 * y3 + x3 * y1 - x1 * y3 - x2 * y1 - x3 * y2
	return abs(A) / 2
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
cx1 = circleX - r
cx2 = circleX + r
cy1 = circleY - r
cy2 = circleY + r
circle = set()
for x in range(cx1, cx2 + 1):
	for y in range(cy1, cy2 + 1):
		if (x - circleX) ** 2 + (y - circleY) ** 2 <= r ** 2:
			circle.add((x, y))
x2 = (x1 + x3 + y3 - y1) / 2
y2 = (y1 + y3 + x1 - x3) / 2
x4 = (x1 + x3 + y1 - y3) / 2
y4 = (y1 + y3 + x3 - x1) / 2
minx = min(x1, x2, x3, x4)
miny = min(y1, y2, y3, y4)
maxx = max(x1, x2, x3, x4)
maxy = max(y1, y2, y3, y4)
square = set()
sa = (x1 - x2) ** 2 + (y1 - y2) ** 2
x = int(minx - 1)
y = int(miny - 1)
for x in range(int(minx - 1), int(maxx + 1 + 1)):
	for y in range(int(miny - 1), int(maxy + 1 + 1)):
		A = area(x, x1, x2, y, y1, y2) + area(x, x2, x3, y, y2, y3) + area(x, x3, x4, y, y3, y4) + area(x, x4, x1, y, y4, y1)
		if sa == A:
			circle.add((x, y))
x = 0
y = 0
for y in range(h):
	s = ''
	for x in range(w):
		if (x, y) in circle:
			s += '#'
		else:
			s += '.'
	print(s)


import sys

def solve(w, h, circle, square):
	(c_x, c_y, c_r) = circle
	(x1, y1, x2, y2) = square

	def dot(a, b):
		return a[0] * b[0] + a[1] * b[1]

	def loc_marker(row, col):
		if (row - c_y) ** 2 + (col - c_x) ** 2 <= c_r ** 2:
			return '#'
		(x3, y3) = ((x1 + x2 + y2 - y1) / 2, (y1 + y2 + x1 - x2) / 2)
		AB = (x3 - x1, y3 - y1)
		AM = (col - x1, row - y1)
		BC = (x2 - x3, y2 - y3)
		BM = (col - x3, row - y3)
		if 0 <= dot(AB, AM) <= dot(AB, AB) and 0 <= dot(BC, BM) <= dot(BC, BC):
			return '#'
		return '.'
	canvas = [[loc_marker(row, column) for column in range(w)] for row in range(h)]
	[print(''.join(row)) for row in canvas]

def main(inp=sys.stdin):
	(w, h) = [int(x) for x in inp.readline().strip().split()]
	circle = [int(x) for x in inp.readline().strip().split()]
	square = [int(x) for x in inp.readline().strip().split()]
	solve(w, h, circle, square)
main()


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def in_circle(x1, y1, r, p1, p2):
	if (p1 - x1) ** 2 + (p2 - y1) ** 2 <= r ** 2:
		return True
	else:
		return False
canvas = []
for i in range(h):
	canvas.append([])
	for j in range(w):
		canvas[i].append('.')
so = circleY - (r + 1)
eo = circleY + (r + 1) + 1
si = circleX - (r + 1)
ei = circleX + (r + 1) + 1
if circleX - (r + 1) < 0:
	si = 0
if circleX + (r + 1) > w:
	ei = w
if circleY - (r + 1) < 0:
	so = 0
if circleY + (r + 1) > h:
	eo = h
for i in range(so, eo):
	for j in range(si, ei):
		if in_circle(circleX, circleY, r, j, i):
			canvas[i][j] = '#'
x2 = (x1 - y1 + x3 + y3) / 2
y2 = (x1 + y1 - x3 + y3) / 2
x4 = (x1 + y1 + x3 - y3) / 2
y4 = (-x1 + y1 + x3 + y3) / 2
top = max(int(min(y1, y2, y3, y4) - 1), 0)
left = max(int(min(x1, x2, x3, x4) - 1), 0)
bottom = min(int(max(y1, y2, y3, y4) + 1), h)
right = min(int(max(x1, x2, x3, x4) + 1), w)

def compute_line(x1, y1, x2, y2, x, y):
	if x2 - x1 != 0:
		return y - y1 - (y2 - y1) / (x2 - x1) * (x - x1)
	else:
		return x - x1

def check_in_square(x, y):
	if compute_line(x1, y1, x2, y2, x, y) * compute_line(x3, y3, x4, y4, x, y) <= 0:
		if compute_line(x1, y1, x4, y4, x, y) * compute_line(x3, y3, x2, y2, x, y) <= 0:
			return True
	return False
for i in range(top, bottom):
	for j in range(left, right):
		if check_in_square(j, i):
			canvas[i][j] = '#'
for i in canvas:
	for j in i:
		print(j, end='')
	print('')


import sys
import sys
import math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def dist(t1, t2):
	return math.sqrt((t1[0] - t2[0]) ** 2 + (t1[1] - t2[1]) ** 2)

def dist2(t1, t2):
	return (t1[0] - t2[0]) ** 2 + (t1[1] - t2[1]) ** 2

def sqarea(a, b, c):
	return min((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2, (a[0] - c[0]) ** 2 + (a[1] - c[1]) ** 2)

def triarea(a, b, c):
	return math.fabs(a[0] * (b[1] - c[1]) + b[0] * (c[1] - a[1]) + c[0] * (a[1] - b[1])) / 2
xc = int((x1 + x3) / 2)
yc = int((y1 + y3) / 2)
x2 = (x1 + x3 + y3 - y1) / 2
y2 = (y1 + y3 + x1 - x3) / 2
x4 = (x1 + x3 - y3 + y1) / 2
y4 = (y1 + y3 - x1 + x3) / 2

def check(x1, x2, x3, x4, y1, y2, y3, y4, x, y):
	if x <= max(x1, x2, x3, x4) and x >= min(x1, x2, x3, x4) and (y <= max(y1, y2, y3, y4)) and (y >= min(y1, y2, y3, y4)):
		return True
	return False
for y in range(h):
	for x in range(w):
		inCircle = dist2((x, y), (circleX, circleY)) <= r ** 2
		if inCircle:
			print('#', end='')
			continue
		area = sqarea((x1, y1), (x2, y2), (x3, y3))
		if area == 0:
			if x == x1 and y == y1:
				print('#', end='')
			else:
				print('.', end='')
			continue
		t1 = triarea((x1, y1), (x2, y2), (x, y))
		t2 = triarea((x2, y2), (x3, y3), (x, y))
		t3 = triarea((x3, y3), (x4, y4), (x, y))
		t4 = triarea((x1, y1), (x4, y4), (x, y))
		inSquare = t1 + t2 + t3 + t4 <= area
		onSquare = False
		onSquare = onSquare or (t1 == 0 and check(x1, x2, x3, x4, y1, y2, y3, y4, x, y))
		onSquare = onSquare or (t2 == 0 and check(x1, x2, x3, x4, y1, y2, y3, y4, x, y))
		onSquare = onSquare or (t3 == 0 and check(x1, x2, x3, x4, y1, y2, y3, y4, x, y))
		onSquare = onSquare or (t4 == 0 and check(x1, x2, x3, x4, y1, y2, y3, y4, x, y))
		if inSquare or onSquare:
			print('#', end='')
			continue
		print('.', end='')
	print()


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def inCircle(x, y, xt, yt, r):
	if r * r >= (xt - x) ** 2 + (yt - y) ** 2:
		return True
	else:
		return False

def ssquare(ax, ay, bx, by, cx, cy):
	s = (ax - cx) * (by - cy) - (bx - cx) * (ay - cy)
	return s

def getbd(ax, ay, cx, cy):
	hx = ax + (cx - ax) / 2
	hy = ay + (cy - ay) / 2
	vax = hx - ax
	vay = hy - ay
	if hx >= ax:
		vbx = vay
		vby = -vax
	else:
		vbx = -vay
		vby = vax
	vdx = -vbx
	vdy = -vby
	bx = hx + vbx
	by = hy + vby
	dx = hx + vdx
	dy = hy + vdy
	return (bx, by, dx, dy)

def inSquare(x, y, x1, y1, x3, y3, tx, ty):
	s1 = ssquare(x1, y1, tx, ty, x, y)
	s2 = ssquare(x1, y1, x, y, x3, y3)
	s3 = ssquare(x, y, tx, ty, x3, y3)
	if s1 * s2 >= 0 and s2 * s3 >= 0 and (s1 * s3 >= 0):
		return True
	else:
		return False
(bx, by, dx, dy) = getbd(x1, y1, x3, y3)
for y in range(h):
	xtr = ''
	for x in range(w):
		if inCircle(circleX, circleY, x, y, r) == True or inSquare(x, y, x1, y1, x3, y3, bx, by) == True or inSquare(x, y, x1, y1, x3, y3, dx, dy) == True:
			xtr = xtr + '#'
		else:
			xtr = xtr + '.'
	print(xtr)


import sys, math

def algo(x):
	return (math.atan2(x['x'] - mlat, x['y'] - mlng) + 2 * math.pi) % (2 * math.pi)
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
t = []
for i in range(h):
	t.append(['.'] * w)
(cx1, cy1) = (circleX - r, circleY - r)
if cx1 < 0:
	cx1 = 0
if cy1 < 0:
	cy1 = 0
(cx2, cy2) = (circleX + r, circleY + r)
if cx2 > w - 1:
	cx2 = w - 1
if cy2 > h - 1:
	cy2 = h - 1
for i in range(w):
	for j in range(h):
		if math.sqrt(abs(i - circleX) ** 2 + abs(j - circleY) ** 2) <= r:
			t[j][i] = '#'
x2 = (x1 + x3 + y3 - y1) / 2
y2 = (y1 + y3 + x1 - x3) / 2
x4 = (x1 + x3 + y1 - y3) / 2
y4 = (y1 + y3 + x3 - x1) / 2
sx = min(x1, x2, x3, x4)
sy = min(y1, y2, y3, y4)
fx = max(x1, x2, x3, x4)
fy = max(y1, y2, y3, y4)
if sx < 0:
	sx = 0
if sy < 0:
	sy = 0
if fx > w - 1:
	fx = w - 1
if fy > h - 1:
	fy = h - 1
l = [{'x': x1, 'y': y1}, {'x': x2, 'y': y2}, {'x': x3, 'y': y3}, {'x': x4, 'y': y4}]
mlat = sum((x['x'] for x in l)) / len(l)
mlng = sum((x['y'] for x in l)) / len(l)
l.sort(key=algo)
(x1, y1) = (l[3]['x'], l[3]['y'])
(x2, y2) = (l[2]['x'], l[2]['y'])
(x3, y3) = (l[1]['x'], l[1]['y'])
(x4, y4) = (l[0]['x'], l[0]['y'])
A1 = -(y2 - y1)
B1 = x2 - x1
C1 = -(A1 * x1 + B1 * y1)
A2 = -(y3 - y2)
B2 = x3 - x2
C2 = -(A2 * x2 + B2 * y2)
A3 = -(y4 - y3)
B3 = x4 - x3
C3 = -(A3 * x3 + B3 * y3)
A4 = -(y1 - y4)
B4 = x1 - x4
C4 = -(A4 * x4 + B4 * y4)
for i in range(w):
	for j in range(h):
		D1 = A1 * i + B1 * j + C1
		D2 = A2 * i + B2 * j + C2
		D3 = A3 * i + B3 * j + C3
		D4 = A4 * i + B4 * j + C4
		if min(D1, D2, D3, D4) >= 0:
			t[j][i] = '#'
for i in t:
	print(''.join(i))


from math import sqrt
(w, h) = map(int, input().split())
(xc, yc, r) = map(int, input().split())
(x1, y1, x3, y3) = map(int, input().split())

def dotcheck(n, m):
	xcenter = (x1 + x3) / 2
	ycenter = (y1 + y3) / 2
	xdiag = (x1 - x3) / 2
	ydiag = (y1 - y3) / 2
	x2 = xcenter - ydiag
	y2 = ycenter + xdiag
	AMx = n - x2
	AMy = m - y2
	ABx = x3 - x2
	ABy = y3 - y2
	ADx = x1 - x2
	ADy = y1 - y2
	AMdotAB = AMx * ABx + AMy * ABy
	ABdotAB = ABx * ABx + ABy * ABy
	AMdotAD = AMx * ADx + AMy * ADy
	ADdotAD = ADx * ADx + ADy * ADy
	if 0 <= AMdotAB <= ABdotAB and 0 <= AMdotAD <= ADdotAD:
		return True
	else:
		return False
raster = []
raster = [['.' for x in range(w)] for x in range(h)]
for m in range(h):
	for n in range(w):
		if sqrt((yc - m) ** 2 + (xc - n) ** 2) <= r:
			raster[m][n] = '#'
		if dotcheck(n, m) == True:
			raster[m][n] = '#'
for table in raster:
	print('%s%s' % (table[0], ''.join(map(str, table[1:]))))


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def is_in_circle(x, y, circleX, circleY, r):
	return (x - circleX) ** 2 + (y - circleY) ** 2 <= r ** 2

def other_corners(x1, y1, x3, y3):
	x2 = x1 + (-(x1 - x3) + (y1 - y3)) / 2
	x4 = x1 + (-(x1 - x3) - (y1 - y3)) / 2
	y2 = y1 + (-(y1 - y3) - (x1 - x3)) / 2
	y4 = y1 + (-(y1 - y3) + (x1 - x3)) / 2
	return (x2, y2, x4, y4)

def extreme_coords(c1, c2, c3, c4):
	arr = [c1, c2, c3, c4]
	return (min(arr), max(arr))

def get_val(pt1x, pt1y, pt2x, pt2y, xtest, ytest):
	return (xtest - pt1x) * (pt2y - pt1y) - (ytest - pt1y) * (pt2x - pt1x)

def is_in_square(x, y, x1, y1, x2, y2, x3, y3, x4, y4):
	v1 = get_val(x1, y1, x2, y2, x, y)
	v2 = get_val(x1, y1, x4, y4, x, y)
	v3 = get_val(x3, y3, x2, y2, x, y)
	v4 = get_val(x3, y3, x4, y4, x, y)
	ref1 = get_val(x1, y1, x2, y2, x3, y3)
	ref2 = get_val(x1, y1, x4, y4, x3, y3)
	ref3 = get_val(x3, y3, x2, y2, x1, y1)
	ref4 = get_val(x3, y3, x4, y4, x1, y1)
	if (v1 * ref1 >= 0) & (v2 * ref2 >= 0) & (v3 * ref3 >= 0) & (v4 * ref4 >= 0):
		return True
	else:
		return False

def calc_grid(w, h, circleX, circleY, r, x1, y1, x3, y3):
	grid = []
	(x2, y2, x4, y4) = other_corners(x1, y1, x3, y3)
	(x_min, x_max) = extreme_coords(x1, x2, x3, x4)
	(y_min, y_max) = extreme_coords(y1, y2, y3, y4)
	for y in range(h):
		row = ['.'] * w
		check_square_y = y >= y_min and y <= y_max
		for x in range(w):
			check_square_x = x >= x_min and x <= x_max
			if is_in_circle(x, y, circleX, circleY, r):
				row[x] = '#'
			elif check_square_x and check_square_y:
				if is_in_square(x, y, x1, y1, x2, y2, x3, y3, x4, y4):
					row[x] = '#'
		grid.append(row)
	return grid

def draw_grid(grid):
	for row in grid:
		print(''.join(row))
grid = calc_grid(w, h, circleX, circleY, r, x1, y1, x3, y3)
draw_grid(grid)


import sys
import math

def in_circle(x, y, x_c, y_c, r):

	def distance(x, y, x_c, y_c):
		return math.sqrt((x - x_c) ** 2 + (y - y_c) ** 2)
	return r >= distance(x, y, x_c, y_c)

def in_square_2(x, y, x1, y1, x3, y3):

	def other_corners(x1, y1, x3, y3):
		x_c = (x1 + x3) / 2
		y_c = (y1 + y3) / 2
		x_d = (x1 - x3) / 2
		y_d = (y1 - y3) / 2
		x2 = x_c - y_d
		y2 = y_c + x_d
		x4 = x_c + y_d
		y4 = y_c - x_d
		return (x2, y2, x4, y4)
	(x2, y2, x4, y4) = other_corners(x1, y1, x3, y3)

	def dot_product(v, w):
		return v[0] * w[0] + v[1] * w[1]
	AM = (x - x1, y - y1)
	AB = (x2 - x1, y2 - y1)
	AD = (x4 - x1, y4 - y1)
	first = 0 <= dot_product(AM, AB) <= dot_product(AB, AB)
	second = 0 <= dot_product(AM, AD) <= dot_product(AD, AD)
	return first and second
(w, h) = map(int, input().strip().split(' '))
(x_c, y_c, r) = map(int, input().strip().split(' '))
(x1, y1, x3, y3) = map(int, input().strip().split(' '))
for i in range(h):
	for j in range(w):
		contained = in_square_2(j, i, x1, y1, x3, y3) or in_circle(j, i, x_c, y_c, r)
		print('.' if not contained else '#', end='')
	print('')


import sys

def vector(start, end):
	return (end[0] - start[0], end[1] - start[1])

def dot(v1, v2):
	return v1[0] * v2[0] + v1[1] * v2[1]

def in_circle(x, y):
	return (x - circleX) ** 2 + (y - circleY) ** 2 <= r ** 2

def within45(u, v):
	d = dot(u, v)
	if d < 0:
		return False
	return dot(u, u) * dot(v, v) <= 2 * d ** 2

def in_square(x, y):
	return within45(vector((x1, y1), (x, y)), V13) and within45(vector((x3, y3), (x, y)), V31)
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
V13 = vector((x1, y1), (x3, y3))
V31 = vector((x3, y3), (x1, y1))
for y in range(h):
	for x in range(w):
		if in_circle(x, y) or in_square(x, y):
			print('#', end='')
		else:
			print('.', end='')
	print()


from math import acos, pi, sqrt
distance = lambda ax, ay, bx, by: sqrt((ax - bx) ** 2 + (ay - by) ** 2)
in_circle = lambda cx, cy, r, x, y: distance(cx, cy, x, y) <= r

def safe_acos(x):
	if x > 1:
		x = 1
	if x < -1:
		x = -1
	return acos(x)

def in_square(x1, y1, x3, y3, x, y):
	xc = (x1 + x3) / 2
	yc = (y1 + y3) / 2
	xd = (x1 - x3) / 2
	yd = (y1 - y3) / 2
	x2 = xc - yd
	y2 = yc + xd
	x4 = xc + yd
	y4 = yc - xd
	side = distance(x1, y1, x2, y2)
	corners = [(x1, y1), (x2, y2), (x3, y3), (x4, y4)]
	if (x, y) in corners:
		return True
	dists = [distance(corner_x, corner_b, x, y) for (corner_x, corner_b) in corners]
	angles = [safe_acos((a ** 2 + b ** 2 - side ** 2) / (2 * a * b)) for (a, b) in zip(dists, dists[1:] + [dists[0]])]
	return any((abs(a - pi) < 1e-05 for a in angles)) or abs(sum(angles) - 2 * pi) < 1e-05
(w, h) = map(int, input().split())
(cx, cy, r) = map(int, input().split())
(x1, y1, x3, y3) = map(int, input().split())
in_square(x1, y1, x3, y3, 0, 0)
grid = [['#' if in_circle(cx, cy, r, x, y) or in_square(x1, y1, x3, y3, x, y) else '.' for x in range(w)] for y in range(h)]
print(*[''.join(row) for row in grid], sep='\n')


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(Xc, Yc, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
canvas = []
for i in range(h):
	canvas.append([])
	for j in range(w):
		canvas[i].append('.')

def find_points_in_circle(w, h, Xc, Yc, r, canvas):
	minY = Yc - r if Yc - r > 0 else 0
	maxY = Yc + r if Yc + r < h else h - 1
	minX = Xc - r if Xc - r > 0 else 0
	maxX = Xc + r if Xc + r < w else w - 1
	for x in range(minX, maxX + 1):
		for y in range(minY, maxY + 1):
			if (x - Xc) ** 2 + (y - Yc) ** 2 <= r ** 2:
				canvas[y][x] = '#'
	return canvas

def find_other_edges_in_square(x1, y1, x3, y3):
	xc = (x1 + x3) / 2
	yc = (y1 + y3) / 2
	xd = (x1 - x3) / 2
	yd = (y1 - y3) / 2
	x2 = xc - yd
	y2 = yc + xd
	x4 = xc + yd
	y4 = yc - xd
	return (x2, y2, x4, y4)

def area_of_triangle(xa, ya, xb, yb, xc, yc):
	return abs(xa * yb + xb * yc + xc * ya - xa * yc - xc * yb - xb * ya) / 2

def area_of_square(x1, y1, x3, y3):
	d = ((x1 - x3) ** 2 + (y1 - y3) ** 2) ** 0.5
	return d ** 2 / 2

def find_points_in_square(w, h, x1, y1, x3, y3, canvas):
	(x2, y2, x4, y4) = find_other_edges_in_square(x1, y1, x3, y3)
	minX = round(min(x1, x2, x3, x4)) if min(x1, x2, x3, x4) > 0 else 0
	minY = round(min(y1, y2, y3, y4)) if min(y1, y2, y3, y4) > 0 else 0
	maxX = round(max(x1, x2, x3, x4)) if max(x1, x2, x3, x4) < w else w - 1
	maxY = round(max(y1, y2, y3, y4)) if max(y1, y2, y3, y4) < h else h - 1
	for x in range(minX, maxX + 1):
		for y in range(minY, maxY + 1):
			area1 = area_of_triangle(x1, y1, x2, y2, x, y)
			area2 = area_of_triangle(x1, y1, x4, y4, x, y)
			area3 = area_of_triangle(x2, y2, x3, y3, x, y)
			area4 = area_of_triangle(x3, y3, x4, y4, x, y)
			sum_of_areas = area1 + area2 + area3 + area4
			if format(sum_of_areas, '.2f') == format(area_of_square(x1, y1, x3, y3), '.2f'):
				canvas[y][x] = '#'
	return canvas
canvas = find_points_in_circle(w, h, Xc, Yc, r, canvas)
canvas = find_points_in_square(w, h, x1, y1, x3, y3, canvas)
for row in canvas:
	print(''.join(row))


def in_circle(x, y, circle):
	(circle_x, circle_y, circle_r) = circle
	sq_distance = (x - circle_x) * (x - circle_x) + (y - circle_y) * (y - circle_y)
	sq_radius = circle_r * circle_r
	return sq_distance <= sq_radius

def other_vertex(square):
	(x1, y1, x3, y3) = square
	(xm, ym) = ((x3 + x1) / 2, (y3 + y1) / 2)
	return (xm + (y3 - y1) / 2, ym - (x3 - x1) / 2)

def scalar(x1, y1, x2, y2):
	return x1 * x2 + y1 * y2

def in_square(px, py, square):
	(ax, ay, cx, cy) = square
	(bx, by) = other_vertex(square)
	baba = scalar(ax - bx, ay - by, ax - bx, ay - by)
	bcbc = scalar(cx - bx, cy - by, cx - bx, cy - by)
	bpba = scalar(px - bx, py - by, ax - bx, ay - by)
	bpbc = scalar(px - bx, py - by, cx - bx, cy - by)
	return 0 <= bpba <= baba and 0 <= bpbc <= bcbc

def read_ints():
	return [int(i) for i in input().split()]
(w, h) = read_ints()
circle = read_ints()
square = read_ints()
for j in range(h):
	for i in range(w):
		if in_circle(i, j, circle) or in_square(i, j, square):
			char = '#'
		else:
			char = '.'
		print(char, end='')
	print()


def foo(x1, y1, x3, y3, x, y):
	x3 -= x1
	y3 -= y1
	x -= x1
	y -= y1
	top = x * x3 + y * y3
	if top < 0:
		return False
	top = top * top
	bottom = (x * x + y * y) * (x3 * x3 + y3 * y3)
	return 2 * top >= bottom
import sys
(w, h) = (int(x) for x in input().strip().split(' '))
(cx, cy, r) = (int(x) for x in input().strip().split(' '))
(x1, y1, x3, y3) = (int(x) for x in input().strip().split(' '))
g = [[0 for i in range(h)] for j in range(w)]
for i in range(w):
	for j in range(h):
		d_sqr = (i - cx) * (i - cx) + (j - cy) * (j - cy)
		if d_sqr <= r * r:
			g[i][j] = 1
		if foo(x1, y1, x3, y3, i, j) and foo(x3, y3, x1, y1, i, j):
			g[i][j] = 1
for j in range(h):
	for i in range(w):
		if g[i][j] == 1:
			print('#', end='')
		else:
			print('.', end='')
	print()


from math import *

def distc(a, b, x, y, r):
	if sqrt(pow(a - x, 2) + pow(b - y, 2)) <= r:
		return 1
	return 0

def dists(x1, y1, x2, y2, x4, y4, x, y):
	bax = x2 - x1
	bay = y2 - y1
	dax = x4 - x1
	day = y4 - y1
	if (x - x1) * bax + (y - y1) * bay < 0.0:
		return False
	if (x - x2) * bax + (y - y2) * bay > 0.0:
		return False
	if (x - x1) * dax + (y - y1) * day < 0.0:
		return False
	if (x - x4) * dax + (y - y4) * day > 0.0:
		return False
	return True
(w, h) = map(int, input().strip().split(' '))
(x, y, r) = map(int, input().strip().split(' '))
(x3, y3, x1, y1) = map(int, input().strip().split(' '))
Ax = (x3 - x1) / 2
Ay = (y3 - y1) / 2
Bx = -Ay
By = Ax
Cx = Ax - Ay
Cy = Ay + Ax
Dx = Ax + Ay
Dy = Ay - Ax
x2 = x1 + Cx
y2 = y1 + Cy
x4 = x1 + Dx
y4 = y1 + Dy
for i in range(h):
	l = ''
	for j in range(w):
		if distc(j, i, x, y, r) or dists(x1, y1, x2, y2, x4, y4, j, i):
			l += '#'
		else:
			l += '.'
	print(l)


import sys

def dot_product(a, b):
	return a[0] * b[0] + a[1] * b[1]

def in_circle(x, y, circleX, circleY, r):
	if (x - circleX) ** 2 + (y - circleY) ** 2 <= r ** 2:
		return True
	else:
		return False

def in_square(x, y, square):
	AB = [square[1][0] - square[0][0], square[1][1] - square[0][1]]
	AM = [x - square[0][0], y - square[0][1]]
	AD = [square[3][0] - square[0][0], square[3][1] - square[0][1]]
	ABdotAB = dot_product(AB, AB)
	AMdotAB = dot_product(AM, AB)
	ADdotAD = dot_product(AD, AD)
	AMdotAD = dot_product(AM, AD)
	if AMdotAB >= 0 and ABdotAB >= AMdotAB and (AMdotAD >= 0) and (ADdotAD >= AMdotAD):
		return True
	else:
		return False
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
xc = (x1 + x3) / 2
yc = (y1 + y3) / 2
xd = (x1 - x3) / 2
yd = (y1 - y3) / 2
x2 = xc - yd
y2 = yc + xd
x4 = xc + yd
y4 = yc - xd
squarepoints = [[x1, y1], [x2, y2], [x3, y3], [x4, y4]]
for y in range(h):
	for x in range(w):
		if in_circle(x, y, circleX, circleY, r) or in_square(x, y, squarepoints):
			print('#', end='')
		else:
			print('.', end='')
	print('')


from math import sqrt, acos, pi, degrees
eps = 0.0001

def dist(x1, y1, x2, y2):
	return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

def inCircle(x, y, xc, yc, r):
	if dist(x, y, xc, yc) <= r + eps:
		return True
	else:
		return False

def inSquare(x, y, x1, y1, x3, y3):
	d1 = dist(x, y, x1, y1)
	if -eps <= d1 <= eps:
		return True
	d3 = dist(x, y, x3, y3)
	if -eps <= d3 <= eps:
		return True
	d = dist(x1, y1, x3, y3)
	if -eps <= d <= eps:
		return False
	if -eps <= d1 + d3 - d <= eps:
		return True
	cos1 = (d1 ** 2 + d ** 2 - d3 ** 2) / (2 * d1 * d)
	if cos1 > 1:
		cos1 = 1
	elif cos1 < -1:
		cos1 = -1
	angle1 = degrees(acos(cos1))
	cos3 = (d3 ** 2 + d ** 2 - d1 ** 2) / (2 * d3 * d)
	if cos3 > 1:
		cos3 = 1
	elif cos3 < -1:
		cos3 = -1
	angle3 = degrees(acos(cos3))
	if angle1 <= 45 + eps and angle3 <= 45 + eps:
		return True
	else:
		return False
(w, h) = [int(_) for _ in input().strip().split()]
(xc, yc, r) = [int(_) for _ in input().strip().split()]
(x1, y1, x3, y3) = [int(_) for _ in input().strip().split()]
for y in range(h):
	for x in range(w):
		if inCircle(x, y, xc, yc, r) or inSquare(x, y, x1, y1, x3, y3):
			print('#', end='')
		else:
			print('.', end='')
	print()


import sys
import math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
sqrt2d = math.sqrt(2) / 2
eps = -1e-10
field = []
for y in range(h):
	l = []
	for x in range(w):
		l.append('.')
	field.append(l)
for x in range(w):
	for y in range(h):
		if (x - circleX) ** 2 + (y - circleY) ** 2 <= r * r:
			field[y][x] = '#'
		else:
			lenA = math.sqrt((x - x1) ** 2 + (y - y1) ** 2)
			lenC = math.sqrt((x - x3) ** 2 + (y - y3) ** 2)
			lenB = math.sqrt((x1 - x3) ** 2 + (y1 - y3) ** 2)
			if lenA == 0 or lenC == 0:
				field[y][x] = '#'
			else:
				cosA = abs((x - x1) * (x3 - x1) + (y - y1) * (y3 - y1)) / lenA / lenB
				cosC = abs((x - x3) * (x1 - x3) + (y - y3) * (y1 - y3)) / lenB / lenC
				if cosA - sqrt2d >= eps and cosC - sqrt2d >= eps and (eps <= lenB - lenA) and (eps <= lenB - lenC):
					field[y][x] = '#'
for z in range(h):
	print(''.join(field[z]))


import sys
import math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
print_circle = r > 0
xc = (x1 + x3) / 2
yc = (y1 + y3) / 2
xd = (x1 - x3) / 2
yd = (y1 - y3) / 2
x2 = xc - yd
y2 = yc + xd
x4 = xc + yd
y4 = yc - xd

def insideCircle(x1, y1, x2, y2):
	return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) <= r

def insideRect(x, y):
	value1 = (x1 - x2) * (y - y2) - (x - x2) * (y1 - y2)
	value2 = (x2 - x3) * (y - y3) - (x - x3) * (y2 - y3)
	value3 = (x3 - x4) * (y - y4) - (x - x4) * (y3 - y4)
	value4 = (x4 - x1) * (y - y1) - (x - x1) * (y4 - y1)
	return value1 <= 0 and value2 <= 0 and (value3 <= 0) and (value4 <= 0)
for y in range(h):
	line = ''
	for x in range(w):
		if print_circle and insideCircle(circleX, circleY, x, y):
			line += '#'
		elif insideRect(x, y):
			line += '#'
		else:
			line += '.'
	print(line)


import sys
import math

def distance(x1, y1, x2, y2):
	return math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)

def in_circle(x, y):
	return distance(x, y, circleX, circleY) <= r

def tsign(p1x, p1y, p2x, p2y, p3x, p3y):
	return (p1x - p3x) * (p2y - p3y) - (p2x - p3x) * (p1y - p3y)

def point_in_triangle(ptx, pty, v1x, v1y, v2x, v2y, v3x, v3y):
	b1 = tsign(ptx, pty, v1x, v1y, v2x, v2y) <= 0
	b2 = tsign(ptx, pty, v2x, v2y, v3x, v3y) <= 0
	b3 = tsign(ptx, pty, v3x, v3y, v1x, v1y) <= 0
	return b1 == b2 and b2 == b3

def in_rectangle(px, py):
	return point_in_triangle(px, py, x1, y1, x2, y2, x4, y4) or point_in_triangle(px, py, x3, y3, x2, y2, x4, y4) or point_in_triangle(px, py, x1, y1, x4, y4, x2, y2) or point_in_triangle(px, py, x3, y3, x4, y4, x2, y2)
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
x2 = (x1 + x3) / 2 - (y3 - y1) / 2
y2 = (x3 - x1) / 2 + (y3 + y1) / 2
x4 = (x1 + x3) / 2 + (y3 - y1) / 2
y4 = -(x3 - x1) / 2 + (y3 + y1) / 2
for i in range(h):
	temp = ''
	for j in range(w):
		if in_circle(j, i) or in_rectangle(j, i):
			temp = temp + '#'
		else:
			temp = temp + '.'
	print(temp)


import sys
from math import sqrt, pow, ceil, floor

class Plotter:

	def __init__(self, w, h):
		self.w = w
		self.h = h
		self.data = []
		for row in range(0, h):
			self.data.append(['.'] * w)

	def circle(self, cx, cy, r):
		for x in range(max(0, floor(cx - r)), min(self.w - 1, ceil(cx + r)) + 1):
			for y in range(max(0, floor(cy - r)), min(self.h - 1, ceil(cy + r)) + 1):
				dist = sqrt(pow(cx - x - 0.5, 2) + pow(cy - y - 0.5, 2))
				if dist <= r:
					self.data[y][x] = '#'

	def pointInTriangle(self, x, y, x1, y1, x2, y2, x3, y3):
		dX = x - x3
		dY = y - y3
		dX21 = x3 - x2
		dY12 = y2 - y3
		D = dY12 * (x1 - x3) + dX21 * (y1 - y3)
		s = dY12 * dX + dX21 * dY
		t = (y3 - y1) * dX + (x1 - x3) * dY
		if D < 0:
			return s <= 0 and t <= 0 and (s + t >= D)
		return s >= 0 and t >= 0 and (s + t <= D)

	def square(self, x1, y1, x3, y3):
		cx = (x1 + x3) / 2
		cy = (y1 + y3) / 2
		dx = (x1 - x3) / 2
		dy = (y1 - y3) / 2
		r = sqrt(pow(cx - x1, 2) + pow(cy - y1, 2))
		x2 = cx - dy
		y2 = cy + dx
		x4 = cx + dy
		y4 = cy - dx
		minX = min(x1, x2, x3, x4)
		maxX = max(x1, x2, x3, x4)
		minY = min(y1, y2, y3, y4)
		maxY = max(y1, y2, y3, y4)
		for x in range(max(0, floor(minX)), min(self.w - 1, ceil(maxX)) + 1):
			for y in range(max(0, floor(minY)), min(self.h - 1, ceil(maxY)) + 1):
				inTriangle1 = self.pointInTriangle(x + 0.5, y + 0.5, x1, y1, x2, y2, x3, y3)
				inTriangle2 = self.pointInTriangle(x + 0.5, y + 0.5, x1, y1, x4, y4, x3, y3)
				if inTriangle1 or inTriangle2:
					self.data[y][x] = '#'

	def plot(self):
		for row in self.data:
			print(''.join(row))
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
p = Plotter(w, h)
p.circle(circleX + 0.5, circleY + 0.5, r)
p.square(x1 + 0.5, y1 + 0.5, x3 + 0.5, y3 + 0.5)
p.plot()


def cp(x1, y1, x2, y2):
	return x1 * y2 - x2 * y1

def goes(x, y):
	v1x = x - x1
	v1y = y - y1
	v2x = x - x2
	v2y = y - y2
	v3x = x - x3
	v3y = y - y3
	v4x = x - x4
	v4y = y - y4
	cp1 = cp(v1x, v1y, v2x, v2y)
	cp2 = cp(v2x, v2y, v3x, v3y)
	cp3 = cp(v3x, v3y, v4x, v4y)
	cp4 = cp(v4x, v4y, v1x, v1y)
	if abs(cp1 + cp2 + cp3 + cp4) == abs(cp1) + abs(cp2) + abs(cp3) + abs(cp4):
		return 1
	else:
		return 0
(w, h) = map(int, input().split())
field = [['.'] * w for i in range(h)]
(xc, yc, r) = map(int, input().split())
(x1, y1, x3, y3) = map(int, input().split())
dx = x1 - x3
dy = y1 - y3
a = (dx + dy) / 2
b = (dx - dy) / 2
x2 = x1 - b
y2 = y1 - a
x4 = x3 + b
y4 = y3 + a
for i in range(0, h):
	for j in range(0, w):
		if x1 == x3 and y1 == y3:
			if i == y1 and j == x1:
				field[i][j] = '#'
		elif goes(j, i):
			field[i][j] = '#'
		if (j - xc) * (j - xc) + (i - yc) * (i - yc) <= r * r:
			field[i][j] = '#'
for i in range(h):
	print(''.join(field[i]))


import sys
from math import sqrt, ceil, floor
(w, h) = map(int, input().strip().split(' '))
(circlej, circlei, r) = map(int, input().strip().split(' '))
(Aj, Ai, Bj, Bi) = map(int, input().strip().split(' '))
grid = []
for i in range(h):
	row = []
	for j in range(w):
		row += ['.']
	grid.append(row)
for i in range(h):
	for j in range(w):
		if (circlei - i) ** 2 + (circlej - j) ** 2 <= r ** 2:
			grid[i][j] = '#'

def vect_prod(vect1, vect2):
	return vect1[0] * vect2[0] + vect1[1] * vect2[1]
AB = [Bi - Ai, Bj - Aj]
(Ci, Cj) = (Ai + AB[1], Aj - AB[0])
(Di, Dj) = (Ai - AB[1], Aj + AB[0])
BD = [Di - Bi, Dj - Bj]
BC = [Ci - Bi, Cj - Bj]
(Ei, Ej) = (Bi + AB[1], Bj - AB[0])
(Fi, Fj) = (Bi - AB[1], Bj + AB[0])
AE = [Ei - Ai, Ej - Aj]
AF = [Fi - Ai, Fj - Aj]
for i in range(h):
	for j in range(w):
		(AM, BM) = ([i - Ai, j - Aj], [i - Bi, j - Bj])
		if vect_prod(AM, AE) >= 0 and vect_prod(AM, AF) >= 0 and (vect_prod(BM, BC) >= 0) and (vect_prod(BM, BD) >= 0):
			grid[i][j] = '#'
for row in grid:
	row_str = ''
	for string in row:
		row_str += string
	print(row_str)


import sys
import math

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def isInCircle(self, c):
		return c.equation(self) <= 0

	def isInSquare(self, sq):
		return sq.isInside(self)

class Circle:

	def __init__(self, p, r):
		(self.xc, self.yc, self.radius) = (p.x, p.y, r)

	def equation(self, p):
		return (p.x - self.xc) ** 2 + (p.y - self.yc) ** 2 - self.radius ** 2

class StraightLine:

	def __init__(self, p1, p2):
		self.a = p2.y - p1.y
		self.b = p1.x - p2.x
		self.c = p2.x * p1.y - p1.x * p2.y

	def equation(self, p):
		return self.a * p.x + self.b * p.y + self.c

class Square:

	def __init__(self, p1, p3):
		(x1, y1) = (p1.x, p1.y)
		(x3, y3) = (p3.x, p3.y)
		(xc, yc) = ((x1 + x3) / 2, (y1 + y3) / 2)
		(d2x, d2y) = (-(y3 - yc), x3 - xc)
		(x2, y2) = (xc - d2x, yc - d2y)
		(x4, y4) = (xc + d2x, yc + d2y)
		self.edge12 = StraightLine(Point(x1, y1), Point(x2, y2))
		self.edge23 = StraightLine(Point(x2, y2), Point(x3, y3))
		self.edge34 = StraightLine(Point(x3, y3), Point(x4, y4))
		self.edge41 = StraightLine(Point(x4, y4), Point(x1, y1))

	def isInside(self, p):
		return self.edge12.equation(p) <= 0 and self.edge23.equation(p) <= 0 and (self.edge34.equation(p) <= 0) and (self.edge41.equation(p) <= 0)
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
c = Circle(Point(circleX, circleY), r)
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
sq = Square(Point(x1, y1), Point(x3, y3))
for j in range(h):
	for i in range(w):
		p = Point(i, j)
		if p.isInCircle(c) or p.isInSquare(sq):
			print('#', end='')
		else:
			print('.', end='')
	print('')


import math
import sys

def in_circle(x, y, circleX, circleY, r):
	if pow(x - circleX, 2) + pow(y - circleY, 2) <= pow(r, 2):
		return True
	else:
		return False

def area(x1, y1, x2, y2, x3, y3):
	return abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2

def in_square(x, y, x1, y1, x3, y3):
	x2 = (x1 + x3 + y3 - y1) / 2
	y2 = (y1 + y3 + x1 - x3) / 2
	x4 = (x1 + x3 + y1 - y3) / 2
	y4 = (y1 + y3 + x3 - x1) / 2
	if pow(x1 - x2, 2) + pow(y1 - y2, 2) == area(x1, y1, x, y, x2, y2) + area(x2, y2, x, y, x3, y3) + area(x3, y3, x, y, x4, y4) + area(x4, y4, x, y, x1, y1):
		return True
	else:
		return False
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
for i in range(h):
	string = ''
	for j in range(w):
		if in_circle(j, i, circleX, circleY, r) or in_square(j, i, x1, y1, x3, y3):
			string += '#'
		else:
			string += '.'
	print(string)


import sys

def dot(a, b):
	return a[0] * b[0] + a[1] * b[1]
(W, H) = input().strip().split(' ')
(W, H) = [int(W), int(H)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(xa, ya, xb, yb) = [int(x1), int(y1), int(x3), int(y3)]
grid = [['.' for w in range(W)] for h in range(H)]
(xm, ym) = ((xa + xb) / 2, (ya + yb) / 2)
(xt, yt) = (xa + (yb - ya), ya + (xa - xb))
(xc, yc) = ((xt + xb) / 2, (yt + yb) / 2)
AC = (xc - xa, yc - ya)
BC = (xc - xb, yc - yb)
for w in range(W):
	for h in range(H):
		AM = (w - xa, h - ya)
		BM = (w - xb, h - yb)
		if 0 <= dot(AM, AC) <= dot(AC, AC) and 0 <= dot(BM, BC) <= dot(BC, BC):
			grid[h][w] = '#'
for w in range(W):
	for h in range(H):
		if ((circleX - w) ** 2 + (circleY - h) ** 2) ** 0.5 <= r:
			grid[h][w] = '#'
for g in grid:
	print(''.join(g))


import sys

def distsqr(x, y, cx, cy):
	dx = x - cx
	dy = y - cy
	return dx * dx + dy * dy
(width, height) = [int(x) for x in input().split()]
(cx, cy, cr) = [int(x) for x in input().split()]
(x1, y1, x3, y3) = [int(x) * 2 for x in input().split()]
canvas = []
for _ in range(height):
	canvas.append(['.' for _ in range(width)])
crsqr = cr * cr
sx = (x1 + x3) // 2
sy = (y1 + y3) // 2
sdx = x3 - sx
sdy = y3 - sy
corners2 = [(sx - sdx, sy - sdy), (sx - sdy, sy + sdx), (sx + sdx, sy + sdy), (sx + sdy, sy - sdx)]
sides2 = []
for i in range(4):
	c1 = corners2[i]
	c2 = corners2[(i + 1) % 4]
	diff = (c2[0] - c1[0], c2[1] - c1[1])
	test = (diff[1], 0 - diff[0], diff[1] * c1[0] - diff[0] * c1[1])
	sides2.append(test)
for y in range(height):
	for x in range(width):
		if distsqr(x, y, cx, cy) <= crsqr:
			canvas[y][x] = '#'
		for s in sides2:
			if (x * s[0] + y * s[1]) * 2 < s[2]:
				break
			if s == sides2[3]:
				canvas[y][x] = '#'
for row in canvas:
	print(''.join(row))


WHITE = '.'
BLACK = '#'
import math

def dot(p1, p2):
	return p1[0] * p2[0] + p1[1] * p2[1]

def sq_length(p):
	return dot(p, p)

def sq_distance(p1, p2):
	return sq_length(difference(p1, p2))

def difference(p1, p2):
	return (p1[0] - p2[0], p1[1] - p2[1])
(w, h) = [int(i) for i in input().strip().split(' ')]
(circleX, circleY, r) = [int(i) for i in input().strip().split(' ')]
(x1, y1, x3, y3) = [int(i) for i in input().strip().split(' ')]
s1 = (x1, y1)
s3 = (x3, y3)
d = difference(s1, s3)
c = (circleX, circleY)
for j in range(h):
	line = []
	for i in range(w):
		p = (i, j)
		color = WHITE
		if sq_distance(p, c) <= r * r:
			color = BLACK
		p1 = difference(s1, p)
		p3 = difference(p, s3)
		dot1 = dot(p1, d)
		dot2 = dot(p3, d)
		in_cone1 = sq_length(p1) * sq_length(d) <= 2 * dot1 * dot1 and 0 <= dot1
		in_cone2 = sq_length(p3) * sq_length(d) <= 2 * dot2 * dot2 and 0 <= dot2
		if in_cone1 and in_cone2:
			color = BLACK
		line.append(color)
	print(''.join(line))


import sys
import math

def distance(x, y):
	return math.hypot(y[0] - x[0], y[1] - x[1])

def isInsideCircle(p, C, r):
	return distance(p, C) <= r

def isBelowLine(p, x, y):
	return (p[0] - y[0]) * (x[1] - y[1]) - (x[0] - y[0]) * (p[1] - y[1]) < 0

def isInsideSquare(p, x1, x3):
	c = ((x1[0] + x3[0]) / 2, (x1[1] + x3[1]) / 2)
	x2 = (x3[1] - c[1] + c[0], -(x3[0] - c[0]) + c[1])
	x4 = (-(x3[1] - c[1]) + c[0], x3[0] - c[0] + c[1])
	cond1 = isBelowLine(p, x1, x2) == isBelowLine(p, x2, x3)
	cond2 = isBelowLine(p, x2, x3) == isBelowLine(p, x3, x4)
	cond3 = isBelowLine(p, x2, x3) == isBelowLine(p, x4, x1)
	return cond1 and cond2 and cond3
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
for i in range(h):
	line = ['.' for k in range(w)]
	for j in range(w):
		if isInsideCircle((j, i), (circleX, circleY), r) or isInsideSquare((j, i), (x1, y1), (x3, y3)):
			line[j] = '#'
	print(''.join(line))


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def in_rect(x, y, x1, y1, x2, y2, x3, y3, x4, y4):
	p21 = [x2 - x1, y2 - y1]
	p41 = [x4 - x1, y4 - y1]
	p21mgt_sq = p21[0] ** 2 + p21[1] ** 2
	p41mgt_sq = p41[0] ** 2 + p41[1] ** 2
	p = [x - x1, y - y1]
	if p[0] * p21[0] + p[1] * p21[1] >= 0 and p[0] * p21[0] + p[1] * p21[1] <= p21mgt_sq:
		if p[0] * p41[0] + p[1] * p41[1] >= 0 and p[0] * p41[0] + p[1] * p41[1] <= p41mgt_sq:
			return '#'
	return '.'

def get_square(x1, y1, x3, y3):
	xc = (x1 + x3) / 2
	yc = (y1 + y3) / 2
	xd = (x1 - x3) / 2
	yd = (y1 - y3) / 2
	x2 = xc - yd
	y2 = yc + xd
	x4 = xc + yd
	y4 = yc - xd
	return [x1, y1, x2, y2, x3, y3, x4, y4]
canvas = [['.' for i in range(w)] for j in range(h)]
(x1, y1, x2, y2, x3, y3, x4, y4) = get_square(x1, y1, x3, y3)
for y in range(h):
	for x in range(w):
		canvas[y][x] = in_rect(x, y, x1, y1, x2, y2, x3, y3, x4, y4)
for y in range(h):
	for x in range(w):
		if ((x - circleX) ** 2 + (y - circleY) ** 2) ** 0.5 <= r:
			canvas[y][x] = '#'
for y in range(h):
	print(''.join(canvas[y]))


from math import sqrt
(w, h) = map(int, input().split())
(cx, cy, r) = map(int, input().split())
(x1, y1, x3, y3) = map(int, input().split())
p1 = (x1, y1)
p3 = (x3, y3)
p2 = ((x1 + x3 + y3 - y1) / 2, (y1 + y3 + x1 - x3) / 2)
p4 = ((x3 + x1 + y1 - y3) / 2, (y3 + y1 + x3 - x1) / 2)

def areaTri(a, b, c):
	return c[0] * b[1] - b[0] * c[1] - (c[0] * a[1] - a[0] * c[1]) + (b[0] * a[1] - a[0] * b[1])

def insideSquare(p):
	if areaTri(p1, p2, p) > 0 or areaTri(p2, p3, p) > 0 or areaTri(p3, p4, p) > 0 or (areaTri(p4, p1, p) > 0):
		return False
	return True

def insideCircle(p):
	return sqrt((p[0] - cx) ** 2 + (p[1] - cy) ** 2) <= r
for y in range(h):
	for x in range(w):
		found = False
		if insideCircle((x, y)):
			print('#', end='')
			found = True
		if not found and insideSquare((x, y)):
			print('#', end='')
			found = True
		if not found:
			print('.', end='')
	print()


import sys
import math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
squareX = (x3 + x1) / 2.0
squareY = (y3 + y1) / 2.0
diagDistance = math.sqrt(float((y3 - y1) ** 2 + (x3 - x1) ** 2))
diagSlope = [(x3 - x1) / diagDistance, (y3 - y1) / diagDistance]
reverseDiagSlope = [-1 * diagSlope[1], diagSlope[0]]
x2 = squareX + reverseDiagSlope[0] * (diagDistance / 2.0)
x4 = squareX - reverseDiagSlope[0] * (diagDistance / 2.0)
y2 = squareY + reverseDiagSlope[1] * (diagDistance / 2.0)
y4 = squareY - reverseDiagSlope[1] * (diagDistance / 2.0)
canvas = []
for i in range(0, h):
	row = []
	for j in range(0, w):
		inCircle = False
		if (i - circleY) ** 2 + (j - circleX) ** 2 <= r ** 2:
			inCircle = True
		inSquare = False
		if (x2 - x1) * (i - y1) - (y2 - y1) * (j - x1) >= 0 and (x3 - x2) * (i - y2) - (y3 - y2) * (j - x2) >= 0 and ((x4 - x3) * (i - y3) - (y4 - y3) * (j - x3) >= 0) and ((x1 - x4) * (i - y4) - (y1 - y4) * (j - x4) >= 0) or ((x2 - x1) * (i - y1) - (y2 - y1) * (j - x1) <= 0 and (x3 - x2) * (i - y2) - (y3 - y2) * (j - x2) <= 0 and ((x4 - x3) * (i - y3) - (y4 - y3) * (j - x3) <= 0) and ((x1 - x4) * (i - y4) - (y1 - y4) * (j - x4) <= 0)):
			inSquare = True
		if inCircle or inSquare:
			row.append(1)
		else:
			row.append(0)
	canvas.append(row)
for i in range(0, h):
	for j in range(0, w):
		if canvas[i][j] == 0:
			print('.', end='')
		else:
			print('#', end='')
	print()


from math import sqrt

def print_grid(grid):
	for line in grid:
		print(''.join(line))

def dist(x1, y1, x2, y2):
	x_d = x2 - x1
	y_d = y2 - y1
	return sqrt(x_d * x_d + y_d * y_d)

def dot_product(a, b, c, d):
	return a * c + b * d

def in_circle(x, y, r, i, j):
	return dist(x, y, i, j) <= r

def in_square(x1, y1, x3, y3, i, j):
	(centre_x, centre_y) = ((x1 + x3) / 2, (y1 + y3) / 2)
	(half_diag_x, half_diag_y) = ((x1 - x3) / 2, (y1 - y3) / 2)
	(x2, y2) = (centre_x + half_diag_y, centre_y - half_diag_x)
	(x4, y4) = (centre_x - half_diag_y, centre_y + half_diag_x)
	(AP_x, AP_y) = (x1 - i, y1 - j)
	(AB_x, AB_y) = (x1 - x2, y1 - y2)
	(AD_x, AD_y) = (x1 - x4, y1 - y4)
	AB_2 = dot_product(AB_x, AB_y, AB_x, AB_y)
	AD_2 = dot_product(AD_x, AD_y, AD_x, AD_y)
	AP_AB = dot_product(AP_x, AP_y, AB_x, AB_y)
	AP_AD = dot_product(AP_x, AP_y, AD_x, AD_y)
	return 0 <= AP_AB <= AB_2 and 0 <= AP_AD <= AD_2

def add_circle(grid, x, y, r):
	for (i, line) in enumerate(grid):
		for (j, point) in enumerate(line):
			if in_circle(x, y, r, j, i):
				grid[i][j] = '#'
	return grid

def add_square(grid, x1, y1, x3, y3):
	for (i, line) in enumerate(grid):
		for (j, point) in enumerate(line):
			if in_square(x1, y1, x3, y3, j, i):
				grid[i][j] = '#'
	return grid
(w, h) = map(int, input().split())
(x_c, y_c, r) = map(int, input().split())
(x1, y1, x3, y3) = map(int, input().split())
grid = [['.' for _ in range(w)] for _ in range(h)]
grid = add_circle(grid, x_c, y_c, r)
grid = add_square(grid, x1, y1, x3, y3)
print_grid(grid)


(w, h) = map(int, input().split())
(cx, cy, r) = map(int, input().split())
(x1, y1, x3, y3) = map(int, input().split())
out = []
for i in range(h):
	out.append([])
	for j in range(w):
		if (cx - j) ** 2 + (cy - i) ** 2 <= r ** 2:
			out[-1].append('#')
		else:
			b2x = x1 + x3 - y1 + y3
			b2y = x1 - x3 + y1 + y3
			dot_ab_am_x4 = 2 * (b2x - 2 * x1) * (j - x1) + 2 * (b2y - 2 * y1) * (i - y1)
			dot_ab_ab_x4 = (b2x - 2 * x1) ** 2 + (b2y - 2 * y1) ** 2
			if 0 <= dot_ab_am_x4 <= dot_ab_ab_x4:
				dot_bc_bm_x4 = (2 * x3 - b2x) * (2 * j - b2x) + (2 * y3 - b2y) * (2 * i - b2y)
				dot_bc_bc_x4 = (2 * x3 - b2x) ** 2 + (2 * y3 - b2y) ** 2
				if 0 <= dot_bc_bm_x4 <= dot_bc_bc_x4:
					out[-1].append('#')
				else:
					out[-1].append('.')
			else:
				out[-1].append('.')
for i in range(h):
	print(*out[i], sep='')


import math
(w, h) = map(int, input().split())
(circleY, circleX, r) = map(float, input().split())
(y1, x1, y3, x3) = map(float, input().split())
xc = (x1 + x3) / 2
yc = (y1 + y3) / 2
xd = (x1 - x3) / 2
yd = (y1 - y3) / 2
(x2, y2) = (xc - yd, yc + xd)
for x in range(h):
	line = ''
	for y in range(w):
		AB = [x2 - x1, y2 - y1]
		AM = [x - x1, y - y1]
		BC = [x3 - x2, y3 - y2]
		BM = [x - x2, y - y2]
		dotAMAB = sum([a * b for (a, b) in zip(AM, AB)])
		dotABAB = sum([a * b for (a, b) in zip(AB, AB)])
		dotBCBM = sum([a * b for (a, b) in zip(BC, BM)])
		dotBCBC = sum([a * b for (a, b) in zip(BC, BC)])
		dist = math.sqrt(pow(x - circleX, 2) + pow(y - circleY, 2))
		if 0 <= dotAMAB <= dotABAB and 0 <= dotBCBM <= dotBCBC or dist <= r:
			line += '#'
		else:
			line += '.'
	print(line)


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
a = [[0 for _ in range(w)] for a in range(h)]
midx = (x1 + x3) / 2
midy = (y1 + y3) / 2
xdif = midx - x1
ydif = midy - y1
x2 = -ydif + midx
y2 = xdif + midy
x4 = ydif + midx
y4 = -xdif + midy
dot12 = (x2 - x1) ** 2 + (y2 - y1) ** 2
dot14 = (x4 - x1) ** 2 + (y4 - y1) ** 2
for i in range(h):
	for j in range(w):
		if (i - circleY) ** 2 + (j - circleX) ** 2 <= r ** 2:
			a[i][j] = 1
		dot2 = (j - x1) * (x2 - x1) + (i - y1) * (y2 - y1)
		dot4 = (j - x1) * (x4 - x1) + (i - y1) * (y4 - y1)
		if 0 <= dot2 and dot2 <= dot12 and (0 <= dot4) and (dot4 <= dot14):
			a[i][j] = 1
for i in range(h):
	for j in range(w - 1):
		if a[i][j] == 1:
			print('#', end='')
		else:
			print('.', end='')
	if a[i][w - 1] == 1:
		print('#')
	else:
		print('.')


(w, h) = [int(i) for i in input().strip().split(' ')]
(xc, yc, r) = [int(i) for i in input().strip().split(' ')]
(x1, y1, x3, y3) = [int(i) for i in input().strip().split(' ')]
(x13, y13) = (x3 - x1, y3 - y1)
(x24, y24) = (-y13, x13)
(x12, y12) = (x13 - x24, y13 - y24)
(x23, y23) = (-y12, x12)
c = -(x23 * x12 + y23 * y12)
for y in range(h):
	for x in range(w):
		p = '.'
		d = (x - xc) ** 2 + (y - yc) ** 2
		if d <= r ** 2:
			p = '#'
		if x23 * (x - x1) + y23 * (y - y1) + c >= 0 and x12 * (x - x3) + y12 * (y - y3) + c <= 0 and (x23 * (x - x3) + y23 * (y - y3) + c <= 0) and (x12 * (x - x1) + y12 * (y - y1) + c >= 0):
			p = '#'
		print(p, end='')
	print()


import sys
import math
eps = 1e-12

class point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __add__(self, other):
		return point(self.x + other.x, self.y + other.y)

	def __sub__(self, other):
		return point(self.x - other.x, self.y - other.y)

	def __truediv__(self, num):
		return point(self.x / num, self.y / num)

	def __str__(self):
		return '({}, {})'.format(self.x, self.y)

	def __eq__(self, other):
		return self.x == other.x and self.y == other.y
	__repr__ = __str__

	def dot(self, other):
		return self.x * other.x + self.y * other.y

	def dist(self, other):
		return (other - self).mag()

	def mag(self):
		return math.sqrt(self.x ** 2 + self.y ** 2)

def in_circle(pt, cen_pt, radius):
	return cen_pt.dist(pt) - eps < radius

def calc_square(cor1, cor3):
	u = (cor3 - cor1) / 2
	v = point(-1 * u.y, u.x)
	mid = cor1 + u
	cor2 = mid + v
	cor4 = mid - v
	return (cor1, cor2, cor3, cor4)

def in_square(pt, square):
	if square[0] == square[2]:
		return pt == square[0]
	for i in range(len(square)):
		x = square[i]
		x_prev = square[i - 1]
		if (x - x_prev).dot(pt - x_prev) < -1 * eps:
			return False
	return True

def solve(in_file, out_file):
	(w, h) = (int(raw) for raw in in_file.readline().strip().split(' '))
	(circleX, circleY, rad) = (int(raw) for raw in in_file.readline().strip().split(' '))
	cen = point(circleX, circleY)
	(x1, y1, x3, y3) = (int(raw) for raw in in_file.readline().strip().split(' '))
	square = calc_square(point(x1, y1), point(x3, y3))
	ret = [['.'] * w for _ in range(h)]
	for x in range(w):
		for y in range(h):
			pt = point(x, y)
			if in_circle(pt, cen, rad) or in_square(pt, square):
				ret[y][x] = '#'
	for row in ret:
		out_file.write('{}\n'.format(''.join(row)))
from_file = False
if from_file:
	path = 'Data\\'
	name = 'square_circ'
	file_input = open(path + name + '.in', 'r')
	file_output = open(path + name + '.out', 'w')
	solve(file_input, file_output)
	file_input.close()
	file_output.close()
else:
	solve(sys.stdin, sys.stdout)


import sys
from fractions import Fraction
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
rSq = r ** 2
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
C1 = (y1, x1)
C3 = (y3, x3)
SqTol = 0
SqMid = [Fraction(C1[0] + C3[0], 2), Fraction(C1[1] + C3[1], 2)]
Shift = [C3[0] - SqMid[0], C3[1] - SqMid[1]]
C2 = (SqMid[0] + Shift[1], SqMid[1] - Shift[0])
C4 = (SqMid[0] - Shift[1], SqMid[1] + Shift[0])
Offset = [-C1[0], -C1[1]]
C = []
for i1 in [C1, C2, C3, C4]:
	C.append(i1[1] + Offset[1] + 1j * (i1[0] + Offset[0]))
PointPairs = ((C1, C2), (C2, C3), (C3, C4), (C4, C1))
SideLen = (2 * abs(Shift[0] + 1j * Shift[1]) ** 2) ** 0.5
if SideLen != 0:
	SqRot = SideLen * (1 + 1j) / C[2]
else:
	SqRot = 1
SideLen = abs(C[1])

def OnEdge(x, y, PointPairs):
	for Pair in PointPairs:
		x1 = Pair[0][1]
		y1 = Pair[0][0]
		x2 = Pair[1][1]
		y2 = Pair[1][0]
		if x1 == x2:
			if x == x1 and (y >= y1 and y <= y2 or (y <= y1 and y >= y2)):
				return True
		elif x != x2:
			slope1 = Fraction(y2 - y1, x2 - x1)
			slope2 = Fraction(y2 - y, x2 - x)
			if slope1 == slope2:
				if x >= x1 and x <= x2 or (x <= x1 and x >= x2):
					return True
	return False

def InSquare(x, y, Offset, SqRot, SideLen, SqTol):
	x += Offset[1]
	y += Offset[0]
	Pt = (x + 1j * y) * SqRot
	if Pt.real >= -SqTol and Pt.imag >= -SqTol:
		if Pt.real <= SideLen + SqTol and Pt.imag <= SideLen + SqTol:
			return True
	return False

def InCircle(x, y, circleX, circleY, rSq):
	rSqPt = (x - circleX) ** 2 + (y - circleY) ** 2
	if rSqPt <= rSq:
		return True
	return False
Valid = []
for i1 in range(h):
	Valid.append('')
	for i2 in range(w):
		if InCircle(i2, i1, circleX, circleY, rSq) or OnEdge(i2, i1, PointPairs) or InSquare(i2, i1, Offset, SqRot, SideLen, SqTol):
			Valid[-1] += '#'
		else:
			Valid[-1] += '.'
for i1 in Valid:
	print(i1)


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def sign(p1, p2, p3):
	ans = (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1])
	return ans

def PointInTriangle(pt, v1, v2, v3):
	b1 = sign(pt, v1, v2) <= 0.0
	b2 = sign(pt, v2, v3) <= 0.0
	b3 = sign(pt, v3, v1) <= 0.0
	return b1 == b2 and b2 == b3

class Grid:

	def __init__(self, w, h):
		self.w = w
		self.h = h
		self.grid = [[False] * w for _ in range(h)]

	def circle(self, cx, cy, r):
		for y in range(self.h):
			for x in range(self.w):
				dist = ((x - cx) ** 2 + (y - cy) ** 2) ** 0.5
				if dist <= r:
					self.grid[y][x] = True

	def square(self, x1, y1, x3, y3):
		a = (x1, y1)
		c = (x3, y3)
		xdiff = x3 - x1
		ydiff = y3 - y1
		x = (xdiff + ydiff) / 2
		y = (xdiff - ydiff) / 2
		d = (x1 + x, y1 - y)
		b = (x1 + y, y1 + x)
		for y in range(self.h):
			for x in range(self.w):
				p = (x, y)
				if PointInTriangle(p, a, b, c) or PointInTriangle(p, a, c, d):
					self.grid[y][x] = True

	def plot(self):
		for row in self.grid:
			print(''.join(['#' if i else '.' for i in row]))
g = Grid(w, h)
g.circle(circleX, circleY, r)
g.square(x1, y1, x3, y3)
g.plot()


import sys, math

def area(x1, x2, x3, y1, y2, y3):
	area1 = 0.5 * abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))
	return area1
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [float(x1), float(y1), float(x3), float(y3)]
mat = [['.' for i in range(w)] for j in range(h)]
for i in range(h):
	for j in range(w):
		if (circleY - i) ** 2 + (circleX - j) ** 2 <= r ** 2:
			mat[i][j] = '#'
x2 = float((x1 + x3 + y3 - y1) / 2.0)
x4 = float((x1 + x3 - y3 + y1) / 2.0)
y2 = float((y1 + y3 - x3 + x1) / 2.0)
y4 = float((y1 + y3 + x3 - x1) / 2.0)
for i in range(h):
	for j in range(w):
		area1 = area(x1, x2, float(j), y1, y2, float(i))
		area2 = area(x2, x3, float(j), y2, y3, float(i))
		area3 = area(x3, x4, float(j), y3, y4, float(i))
		area4 = area(x4, x1, float(j), y4, y1, float(i))
		areaSQ = (x1 - x2) ** 2 + (y1 - y2) ** 2
		if areaSQ >= area1 + area2 + area3 + area4:
			mat[i][j] = '#'
for i in range(h):
	for j in range(w):
		print(mat[i][j], end='')
	print()


import math

def withinSquare(x1, y1, x2, y2, x3, y3):
	ans = (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2
	if ans < 0:
		ans = -ans
	return ans
(w, h) = input().strip().split(' ')
(width, height) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(Ax, Ay, Cx, Cy) = [int(x1), int(y1), int(x3), int(y3)]
l = []
for i in range(0, height):
	t = []
	for j in range(0, width):
		t.append('.')
	l.append(t)
Bx = (Ax + Cx + Cy - Ay) / 2
By = (Ay + Cy + Ax - Cx) / 2
Dx = (Ax + Cx + Ay - Cy) / 2
Dy = (Ay + Cy + Cx - Ax) / 2
area = math.pow(Ax - Bx, 2) + math.pow(Ay - By, 2)
for i in range(0, height):
	s = ''
	for j in range(0, width):
		x = j
		y = i
		ans = math.sqrt(math.pow(x - circleX, 2) + math.pow(y - circleY, 2))
		if ans <= r:
			l[i][j] = '#'
		else:
			ans = withinSquare(Ax, Ay, x, y, Dx, Dy) + withinSquare(Dx, Dy, x, y, Cx, Cy) + withinSquare(Cx, Cy, x, y, Bx, By) + withinSquare(x, y, Bx, By, Ax, Ay)
			if ans <= area:
				l[i][j] = '#'
		s = s + l[i][j]
	s = s[:len(s)]
	print(s)


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
import math
s = [['.' for i in range(h)] for j in range(w)]

def dist2(x1, y1, x2, y2):
	return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)
r2 = r * r
side_2 = dist2(x1, y1, x3, y3) / 2
vec_a_mod_2 = dist2(x1, y1, x3, y3)
ax = x3 - x1
ay = y3 - y1
cos45_2 = 1 / 2
for x in range(w):
	for y in range(h):
		if dist2(circleX, circleY, x, y) <= r2:
			s[x][y] = '#'
		bx = x - x1
		by = y - y1
		vec_b_mod_2 = dist2(x1, y1, x, y)
		if vec_b_mod_2 <= side_2:
			if vec_b_mod_2 > 0:
				u = ax * bx + ay * by
				g = -1 if u < 0 else 1
				cos_phi_2 = u * u / (vec_a_mod_2 * vec_b_mod_2)
				if cos_phi_2 >= cos45_2 and g == 1:
					s[x][y] = '#'
			else:
				s[x][y] = '#'
		bx = x - x3
		by = y - y3
		vec_b_mod_2 = dist2(x3, y3, x, y)
		if vec_b_mod_2 <= side_2:
			if vec_b_mod_2 > 0:
				u = -ax * bx + -ay * by
				g = -1 if u < 0 else 1
				cos_phi_2 = u * u / (vec_a_mod_2 * vec_b_mod_2)
				if cos_phi_2 >= cos45_2 and g == 1:
					s[x][y] = '#'
			else:
				s[x][y] = '#'
for y in range(h):
	for x in range(w):
		print(s[x][y], end='')
	print()


import math

def sign_trianle(x1, y1, x2, y2, x3, y3):
	return (x1 - x3) * (y2 - y3) - (x2 - x3) * (y1 - y3)

def sign_trianle_with_double(x1, y1, x2, y2, x3_double, y3_double):
	return (2 * x1 - x3_double) * (2 * y2 - y3_double) - (2 * x2 - x3_double) * (2 * y1 - y3_double)

def point_in_triangle(x, y, x1, y1, x2, y2, x3, y3):
	s1 = sign_trianle(x, y, x1, y1, x2, y2) <= 0
	s2 = sign_trianle(x, y, x2, y2, x3, y3) <= 0
	s3 = sign_trianle(x, y, x3, y3, x1, y1) <= 0
	return s1 == s2 and s2 == s3

def point_in_triangle_with_double(x, y, x1, y1, x2, y2, x3_double, y3_double):
	s1 = sign_trianle(x, y, x1, y1, x2, y2) <= 0
	s2 = sign_trianle_with_double(x, y, x2, y2, x3_double, y3_double) <= 0
	s3 = sign_trianle_with_double(x, y, x1, y1, x3_double, y3_double) <= 0
	return s1 == s2 and s2 == s3

def raster_graphics(w, h, xc, yc, radius, x1, y1, x3, y3):
	res = []
	for i in range(h):
		res.append(['.'] * w)
	radius2 = radius * radius
	for i in range(max(0, xc - radius - 1), min(w, xc + radius + 1)):
		for j in range(max(0, yc - radius - 1), min(h, yc + radius + 1)):
			i_minusxc = i - xc
			j_minus_yc = j - yc
			if i_minusxc * i_minusxc + j_minus_yc * j_minus_yc <= radius2:
				res[j][i] = '#'
	xcenter = (x1 + x3) / 2
	ycenter = (y1 + y3) / 2
	diameter2 = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3)
	diameter = math.sqrt(diameter2)
	diameter_half = diameter / 2
	x1_double = 2 * x1
	y1_double = 2 * y1
	x3_double = 2 * x3
	y3_double = 2 * y3
	x2 = (x1 + x3 + y3 - y1) / 2
	y2 = (y1 + y3 + x1 - x3) / 2
	x2_double = x1 + x3 + y3 - y1
	y2_double = y1 + y3 + x1 - x3
	x4 = (x1 + x3 + y1 - y3) / 2
	y4 = (y1 + y3 + x3 - x1) / 2
	x4_double = x1 + x3 + y1 - y3
	y4_double = y1 + y3 + x3 - x1
	for i in range(max(0, int(xcenter - diameter_half - 1)), min(w, int(xcenter + diameter_half + 1))):
		for j in range(max(0, int(ycenter - diameter_half - 1)), min(h, int(ycenter + diameter_half + 1))):
			if res[j][i] == '#':
				continue
			if point_in_triangle(2 * i, 2 * j, x1_double, y1_double, x3_double, y3_double, x2_double, y2_double):
				res[j][i] = '#'
				continue
			if point_in_triangle(2 * i, 2 * j, x1_double, y1_double, x4_double, y4_double, x3_double, y3_double):
				res[j][i] = '#'
				continue
			if point_in_triangle(2 * i, 2 * j, x1_double, y1_double, x3_double, y3_double, x4_double, y4_double):
				res[j][i] = '#'
				continue
	return res
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
res = raster_graphics(w, h, circleX, circleY, r, x1, y1, x3, y3)
for i in range(len(res)):
	print(''.join(res[i]))


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [float(circleX), float(circleY), float(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
output = [['.' for x in range(w)] for y in range(h)]
for i in range(w):
	for j in range(h):
		if ((i - circleX) * (i - circleX) + (j - circleY) * (j - circleY)) ** 0.5 <= r:
			output[j][i] = '#'
cx = (x3 + x1) / 2
cy = (y3 + y1) / 2
x2 = -(y3 - cy) + cx
y2 = x3 - cx + cy
x4 = -(y1 - cy) + cx
y4 = x1 - cx + cy
xmin = min(x1, x2, x3, x4)
xmax = max(x1, x2, x3, x4)
ymin = min(y1, y2, y3, y4)
ymax = max(y1, y2, y3, y4)
for i in range(w):
	for j in range(h):
		if i >= xmin and i <= xmax and (j >= ymin) and (j <= ymax):
			apx = i - x1
			apy = j - y1
			abx = x2 - x1
			aby = y2 - y1
			adx = x4 - x1
			ady = y4 - y1
			apab = apx * abx + apy * aby
			abab = abx * abx + aby * aby
			apad = apx * adx + apy * ady
			adad = adx * adx + ady * ady
			if (0 <= apab and apab <= abab) ^ (0 <= apad and apad <= adad):
				pass
			else:
				output[j][i] = '#'
for i in range(h):
	s1 = ''
	for j in range(w):
		s1 += output[i][j]
	print(s1)


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
(tcx, tcy) = (x1 + x3, y1 + y3)
(vdirx, vdiry) = (x1 - x3, y1 - y3)
pmax = vdirx ** 2 + vdiry ** 2
for y in range(h):
	for x in range(w):
		if (circleX - x) ** 2 + (circleY - y) ** 2 <= r ** 2:
			print('#', end='')
			continue
		plat = (2 * x - tcx) * vdirx + (2 * y - tcy) * vdiry
		pperp = (2 * x - tcx) * vdiry - (2 * y - tcy) * vdirx
		print('#' if abs(plat) + abs(pperp) <= pmax else '.', end='')
	print()


import math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
x2 = (x1 + x3 + y1 - y3) / 2
y2 = (y1 + y3 + x3 - x1) / 2
x4 = (x1 + x3 - y1 + y3) / 2
y4 = (y1 + y3 - x3 + x1) / 2

def inCircle(x, y):
	distSq = distSquare(x, y, circleX, circleY)
	if distSq <= r * r:
		return True
	else:
		return False

def inSquare(x, y):
	area = math.pow(x1 - x2, 2) + math.pow(y1 - y2, 2)
	areaComputed = (Area(x, y, x1, y1, x2, y2) + Area(x, y, x2, y2, x3, y3) + Area(x, y, x3, y3, x4, y4) + Area(x, y, x4, y4, x1, y1)) / 2
	if areaComputed == area:
		return True
	else:
		return False

def distSquare(x, y, xs, ys):
	return math.pow(x - xs, 2) + math.pow(y - ys, 2)

def Area(x1, y1, x2, y2, x3, y3):
	area = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)
	if area < 0:
		return area * -1
	return area
arr = [['.' for i in range(h)] for i in range(w)]
for x_temp in range(w):
	for y_temp in range(h):
		if inCircle(x_temp, y_temp):
			arr[x_temp][y_temp] = '#'
		elif inSquare(x_temp, y_temp):
			arr[x_temp][y_temp] = '#'
		else:
			arr[x_temp][y_temp] = '.'
for y_temp in range(h):
	for x_temp in range(w):
		print(arr[x_temp][y_temp], end='')
	print()


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]

def in_circle(sX, sY, r, x, y):
	return (x - sX) ** 2 + (y - sY) ** 2 <= r ** 2

def dot(u, v):
	return u[0] * v[0] + u[1] * v[1]

def in_square(x1, y1, x3, y3, x, y):
	(x13, y13) = (x3 - x1, y3 - y1)
	(xs, ys) = (x1 + x13 / 2, y1 + y13 / 2)
	(xs2, ys2) = (-y13 / 2, x13 / 2)
	(x2, y2) = (xs + xs2, ys + ys2)
	v12 = (x2 - x1, y2 - y1)
	v23 = (x3 - x2, y3 - y2)
	v1t = (x - x1, y - y1)
	v2t = (x - x2, y - y2)
	return 0 <= dot(v12, v1t) <= dot(v12, v12) and 0 <= dot(v23, v2t) <= dot(v23, v23)
for y in range(h):
	for x in range(w):
		if in_circle(circleX, circleY, r, x, y) or in_square(x1, y1, x3, y3, x, y):
			print('#', end='')
		else:
			print('.', end='')
	print()


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
rsq = r * r
a = y3 - y1
b = x1 - x3
c = x3 * y1 - x1 * y3
A = x1 - x3
B = y1 - y3
C = x1 * x3 + y1 * y3 - x1 * x1 - y1 * y1
AA = x3 - x1
BB = y3 - y1
CC = x3 * x1 + y3 * y1 - x3 * x3 - y3 * y3

def inCircle(x, y):
	return (x - circleX) * (x - circleX) + (y - circleY) * (y - circleY) <= rsq

def inSq(x, y):
	pdsq = 2 * (a * x + b * y + c) ** 2
	ponesq = ((x - x1) ** 2 + (y - y1) ** 2) * (a * a + b * b)
	ptwosq = ((x - x3) ** 2 + (y - y3) ** 2) * (a * a + b * b)
	return pdsq <= ponesq and pdsq <= ptwosq and ((A * x + B * y + C) * (A * x3 + B * y3 + C) >= 0) and ((AA * x + BB * y + CC) * (AA * x1 + BB * y1 + CC) >= 0)
for i in range(h):
	for j in range(w):
		print('#' if inSq(j, i) or inCircle(j, i) else '.', end='')
	print()


(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
(e, f) = (x3 - x1, y3 - y1)
dd = e * e + f * f

def in_circle(x, y):
	return (x - circleX) ** 2 + (y - circleY) ** 2 <= r ** 2

def in_manhattan(x, y, u, v):
	(a, b) = (x - u, y - v)
	c = abs(a * e + b * f)
	if dd - c < 0:
		return False
	return (a * a + b * b) * dd <= dd * dd - 2 * dd * c + 2 * c * c
for y in range(h):
	print(''.join(('#' if in_circle(x, y) or (in_manhattan(x, y, x1, y1) and in_manhattan(x, y, x3, y3)) else '.' for x in range(w))))


import sys
(w, h) = [int(x) for x in input().strip().split(' ')]
(cX, cY, r) = [int(x) for x in input().strip().split(' ')]
(x1, y1, x3, y3) = [int(x) for x in input().strip().split(' ')]
grid = []
for _ in range(h):
	grid.append(['.'] * w)
x2 = (x1 + x3 + y3 - y1) / 2
y2 = (y1 + y3 + x1 - x3) / 2
for i in range(h):
	for j in range(w):
		if (j - cX) ** 2 + (i - cY) ** 2 <= r ** 2:
			grid[i][j] = '#'
		if 0 <= (j - x2) * (x1 - x2) + (i - y2) * (y1 - y2) <= (x1 - x2) ** 2 + (y1 - y2) ** 2 and 0 <= (j - x2) * (x3 - x2) + (i - y2) * (y3 - y2) <= (x3 - x2) ** 2 + (y3 - y2) ** 2:
			grid[i][j] = '#'
for x in grid:
	print(''.join(x))


import sys
import math

def dist(x1, y1, x2, y2):
	return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

def isPointBelongsToCircle(x, y, cx, cy, r):
	if dist(x, y, cx, cy) <= r:
		return True
	else:
		return False

def isPointBelongsToSquare(x, y, x1, y1, x3, y3):
	if x == x1 and y == y1:
		return True
	if x == x3 and y == y3:
		return True
	if x1 == x3 and y1 == y3:
		return False
	c = dist(x1, y1, x3, y3)
	cos_angle = round((x - x1) * (x3 - x1) + (y - y1) * (y3 - y1), 5) / round(c * dist(x, y, x1, y1), 5)
	sin_angle = math.sqrt(1 - cos_angle ** 2)
	if round(cos_angle, 5) < round(math.sqrt(2) / 2, 5):
		return False
	if round(dist(x, y, x1, y1), 5) <= round(c / (cos_angle + sin_angle), 5):
		return True
	else:
		return False
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
for y in range(0, h):
	for x in range(0, w):
		if isPointBelongsToCircle(x, y, circleX, circleY, r) or isPointBelongsToSquare(x, y, x1, y1, x3, y3):
			print('#', end='')
		else:
			print('.', end='')
	print('')


import sys

def draw_board(w, h):
	return [['.' for i in range(w)] for i in range(h)]

def draw_circle(board, x, y, r):
	h = len(board)
	w = len(board[0])
	for i in range(h):
		for j in range(w):
			d_2 = (i - y) ** 2 + (j - x) ** 2
			if d_2 <= r ** 2:
				board[i][j] = '#'

def point_to_line(x, y, x1, y1, x2, y2):
	return ((y2 - y1) * x - (x2 - x1) * y + x2 * y1 - y2 * x1) ** 2 / ((y2 - y1) ** 2 + (x2 - x1) ** 2)

def draw_square(board, x1, y1, x3, y3):
	h = len(board)
	w = len(board[0])
	x0 = (x1 + x3) / 2
	y0 = (y1 + y3) / 2
	x2 = x0 + (y1 - y0)
	y2 = y0 - (x1 - x0)
	x4 = x0 - (y1 - y0)
	y4 = y0 + (x1 - x0)
	side_length_2 = (x1 - x2) ** 2 + (y1 - y2) ** 2
	for y in range(h):
		for x in range(w):
			if point_to_line(x, y, x1, y1, x2, y2) <= side_length_2 and point_to_line(x, y, x1, y1, x4, y4) <= side_length_2 and (point_to_line(x, y, x3, y3, x2, y2) <= side_length_2) and (point_to_line(x, y, x3, y3, x4, y4) <= side_length_2):
				board[y][x] = '#'

def board_print(board):
	for row in board:
		print(''.join(row))
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
board = draw_board(w, h)
draw_circle(board, circleX, circleY, r)
draw_square(board, x1, y1, x3, y3)
board_print(board)


import sys
import math
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(y, x, r) = [int(circleX), int(circleY), int(r)]
(y1, x1, y3, x3) = map(int, input().strip().split(' '))
mat = [['.' for _ in range(w)] for _ in range(h)]
left = max(0, y - r)
right = min(w - 1, y + r)
top = max(0, x - r)
bottom = min(h - 1, x + r)
for i in range(top, bottom + 1):
	for j in range(left, right + 1):
		if math.sqrt((i - x) ** 2 + (j - y) ** 2) <= r:
			mat[i][j] = '#'
xc = (x1 + x3) / 2
yc = (y1 + y3) / 2
t = x1 - xc
y2 = yc - t
y4 = yc + t
l = y1 - yc
x2 = xc + l
x4 = xc - l
left = math.floor(max(0, min(y1, y2, y3, y4)))
right = math.ceil(min(w - 1, max(y1, y2, y3, y4)))
top = math.floor(max(0, min(x1, x2, x3, x4)))
bottom = math.ceil(min(h - 1, max(x1, x2, x3, x4)))
if x2 - x1 == 0 or y2 - y1 == 0:
	for i in range(top, bottom + 1):
		for j in range(left, right + 1):
			mat[i][j] = '#'
else:
	for x in range(top, bottom + 1):
		for y in range(left, right + 1):
			a1 = (x - x1) * (y - y2) - (y - y1) * (x - x2)
			a2 = (x - x2) * (y - y3) - (y - y2) * (x - x3)
			a3 = (x - x3) * (y - y4) - (y - y3) * (x - x4)
			a4 = (x - x4) * (y - y1) - (y - y4) * (x - x1)
			if a1 <= 0 and a2 <= 0 and (a3 <= 0) and (a4 <= 0) or (a1 >= 0 and a2 >= 0 and (a3 >= 0) and (a4 >= 0)):
				mat[x][y] = '#'
for i in range(h):
	print(''.join(mat[i]))


import sys

def circle_set(x, y, r):
	if r == 0:
		return set()
	s = set([(x, y)])
	for i in range(r):
		s.add((x - i - 1, y))
		s.add((x + i + 1, y))
		s.add((x, y - i - 1))
		s.add((x, y + i + 1))
	for i in range(1, r):
		for j in range(int((r * r - i * i) ** 0.5)):
			s.add((x - j - 1, y + i))
			s.add((x + j + 1, y + i))
			s.add((x - j - 1, y - i))
			s.add((x + j + 1, y - i))
	return s

def square_set(x1, y1, x3, y3):
	if x1 == x3 and y1 == y3:
		return set()
	s = set()
	xc = (x1 + x3) / 2.0
	yc = (y1 + y3) / 2.0
	xd = (x3 - x1) / 2.0
	yd = (y3 - y1) / 2.0
	x2 = xc - yd
	y2 = yc + xd
	x4 = xc + yd
	y4 = yc - xd
	for i in range(round(min(x1, x2, x3, x4)), round(max(x1, x2, x3, x4)) + 1):
		for j in range(round(min(y1, y2, y3, y4)), round(max(y1, y2, y3, y4)) + 1):
			if 0 <= (i - x2) * (x1 - x2) + (j - y2) * (y1 - y2) <= (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) and 0 <= (i - x2) * (x3 - x2) + (j - y2) * (y3 - y2) <= (x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2):
				s.add((i, j))
	return s
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
cs = circle_set(circleX, circleY, r)
ss = square_set(x1, y1, x3, y3)
for i in range(h):
	for j in range(w):
		if (j, i) in cs or (j, i) in ss:
			print('#', end='')
		else:
			print('.', end='')
	print()


def dot(x, y):
	return sum((i * j for (i, j) in zip(x, y)))
(w, h) = [int(a) for a in input().split()]
(xc, yc, r) = [int(a) for a in input().split()]
(x1, y1, x3, y3) = [int(a) for a in input().split()]
(xd, yd) = ((x1 + x3) / 2, (y1 + y3) / 2)
(a, b) = ((x3 - x1) / 2, (y3 - y1) / 2)
(x2, y2) = (xd + b, yd - a)
(x4, y4) = (xd - b, yd + a)
v1 = [x2 - x1, y2 - y1]
v2 = [x4 - x1, y4 - y1]
n1 = dot(v1, v1)
n2 = dot(v2, v2)
canvas = [['.' for j in range(h)] for i in range(w)]
for i in range(w):
	for j in range(h):
		if (i - xc) ** 2 + (j - yc) ** 2 <= r * r:
			canvas[i][j] = '#'
		v3 = [i - x1, j - y1]
		if 0 <= dot(v1, v3) <= n1 and 0 <= dot(v2, v3) <= n2:
			canvas[i][j] = '#'
canvas = [list(a) for a in zip(*canvas)]
for i in range(h):
	print(*canvas[i], sep='')


import sys

def dot(vx1, vy1, vx2, vy2):
	return vx1 * vx2 + vy1 * vy2

def coordinate_in_circle(cx, cy, r, x, y):
	return (cx - x) ** 2 + (cy - y) ** 2 <= r ** 2

def coordinate_in_square(abx, aby, adx, ady, amx, amy):
	am_dot_ab = dot(abx, aby, amx, amy)
	ab_dot_ab = dot(abx, aby, abx, aby)
	am_dot_ad = dot(adx, ady, amx, amy)
	ad_dot_ad = dot(adx, ady, adx, ady)
	return 0 <= am_dot_ab <= ab_dot_ab and 0 <= am_dot_ad <= ad_dot_ad

def in_grid(width, height, x, y):
	return 0 <= x <= width and 0 <= y <= height
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
print_grid = [['.' for _ in range(w)] for _ in range(h)]
(mx, my) = [(x1 + x3) / 2, (y1 + y3) / 2]
(mvx, mvy) = [(y3 - y1) / 2, (x1 - x3) / 2]
(x2, y2) = [mx + mvx, my + mvy]
(x4, y4) = [mx - mvx, my - mvy]
(abx, aby) = (x2 - x1, y2 - y1)
(adx, ady) = (x4 - x1, y4 - y1)
for y in range(h):
	for x in range(w):
		if in_grid(w, h, x, y) and coordinate_in_circle(circleX, circleY, r, x, y):
			print_grid[y][x] = '#'
		else:
			(amx, amy) = (x - x1, y - y1)
			if coordinate_in_square(abx, aby, adx, ady, amx, amy):
				print_grid[y][x] = '#'
for row in print_grid:
	print(''.join(row))


import sys
from math import acos, degrees
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
r_sq = r * r
A = ((x1 - x3) ** 2 + (y1 - y3) ** 2) / 2
x_M = (x1 + x3) / 2
y_M = (y1 + y3) / 2
x_M1 = x1 - x_M
y_M1 = y1 - y_M
x2 = x_M - y_M1
y2 = y_M + x_M1
x4 = x_M + y_M1
y4 = y_M - x_M1
for y in range(h):
	for x in range(w):
		if (x - circleX) ** 2 + (y - circleY) ** 2 <= r_sq:
			print('#', end='')
		else:
			A1 = 0.5 * abs(x * (y1 - y2) + x1 * (y2 - y) + x2 * (y - y1))
			A2 = 0.5 * abs(x * (y2 - y3) + x2 * (y3 - y) + x3 * (y - y2))
			A3 = 0.5 * abs(x * (y3 - y4) + x3 * (y4 - y) + x4 * (y - y3))
			A4 = 0.5 * abs(x * (y4 - y1) + x4 * (y1 - y) + x1 * (y - y4))
			if abs(A1 + A2 + A3 + A4 - A) < 0.0001:
				print('#', end='')
			else:
				print('.', end='')
	print('')


import sys

def dist(p1x, p1y, p2x, p2y):
	return ((p1x - p2x) ** 2 + (p1y - p2y) ** 2) ** 0.5

def getRect():
	d = dist(x1, y1, x3, y3)
	deltaY = y1 - y3
	deltaX = x1 - x3
	(centerX, centerY) = (x1 - deltaX / 2, y1 - deltaY / 2)
	(x2, y2) = (centerX - deltaY / 2, centerY + deltaX / 2)
	(x4, y4) = (centerX + deltaY / 2, centerY - deltaX / 2)
	area = dist(x1, y1, x2, y2) ** 2
	return {'a': {'x': x1, 'y': y1}, 'b': {'x': x2, 'y': y2}, 'c': {'x': x3, 'y': y3}, 'd': {'x': x4, 'y': y4}, 'area': area}

def getTriangleArea(p1, p2, p3):
	a = dist(p1['x'], p1['y'], p2['x'], p2['y'])
	b = dist(p1['x'], p1['y'], p3['x'], p3['y'])
	c = dist(p3['x'], p3['y'], p2['x'], p2['y'])
	s = (a + b + c) / 2.0
	if a + b <= c or c + b <= a or a + c <= b:
		return 0
	area = (s * (s - a) * (s - b) * (s - c)) ** 0.5
	return area
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
rec = getRect()

def inCircle(x, y):
	return dist(x, y, circleX, circleY) <= r

def inRect(x, y):
	p = {'x': x, 'y': y}
	tArea = getTriangleArea(rec['a'], p, rec['b'])
	tArea += getTriangleArea(rec['a'], p, rec['d'])
	tArea += getTriangleArea(rec['b'], p, rec['c'])
	tArea += getTriangleArea(rec['d'], p, rec['c'])
	return abs(tArea - rec['area']) < 0.001
rec = getRect()
grid = [['.' for i in range(w)] for j in range(h)]
for y in range(len(grid)):
	for x in range(len(grid[y]) - 1, -1, -1):
		if inCircle(x, y) or inRect(x, y):
			grid[y][x] = '#'
	print(''.join(grid[y]))


import sys
import math

def isInCircle(ptsX, ptsY, circleX, circleY, r):
	return math.sqrt(pow(abs(ptsX - circleX), 2) + pow(abs(ptsY - circleY), 2)) <= r

def squareVertices(x1, x2, y1, y2):
	y3 = (x1 + x2 + y2 - y1) / 2
	x3 = (y1 + y2 + x1 - x2) / 2
	x4 = (x1 + x2 + y1 - y2) / 2
	y4 = (y1 + y2 + x2 - x1) / 2
	r = [(x3, y3), (x4, y4)]
	return r

def computeTriangleArea(x0, y0, x1, y1, x2, y2):
	return (x1 * y2 - y1 * x2 - x0 * y2 + y0 * x2 + x0 * y1 - y0 * x1) / 2

def isInSquare(x, y, square):
	A = computeTriangleArea(square[0][0], square[0][1], square[1][0], square[1][1], x, y)
	B = computeTriangleArea(square[1][0], square[1][1], square[2][0], square[2][1], x, y)
	C = computeTriangleArea(square[2][0], square[2][1], square[3][0], square[3][1], x, y)
	D = computeTriangleArea(square[3][0], square[3][1], square[0][0], square[0][1], x, y)
	if A >= 0 and B >= 0 and (C >= 0) and (D >= 0) or (A <= 0 and B <= 0 and (C <= 0) and (D <= 0)):
		return True
	return False
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
s = squareVertices(x1, y1, x3, y3)
square = [(x1, y1), s[0], (x3, y3), s[1]]
for i in range(h):
	res = ''
	for j in range(w):
		if isInCircle(j, i, circleX, circleY, r) or isInSquare(j, i, square):
			res += '#'
		else:
			res += '.'
	print(res)


import sys
import math

def euclidean_distance(c1, r1, c2, r2):
	return math.sqrt(math.pow(c1 - c2, 2) + math.pow(r1 - r2, 2))

def almost_equal(a, b, eps):
	return abs(a - b) <= eps

def area_triangle(x1, y1, x2, y2, x3, y3):
	return abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)))

def in_circle(col, row, ccol, ccrow, cr):
	return euclidean_distance(col, row, ccol, crow) <= cr

def in_square(col, row, scol1, srow1, scol3, srow3):
	a = (scol1, srow1)
	c = (scol3, srow3)
	b = ((a[0] + c[0] + c[1] - a[1]) / 2, (a[1] + c[1] + a[0] - c[0]) / 2)
	d = ((a[0] + c[0] + a[1] - c[1]) / 2, (a[1] + c[1] + c[0] - a[0]) / 2)
	p = (col, row)
	diag = euclidean_distance(a[0], a[1], c[0], c[1])
	area_square = math.pow(diag, 2) / 2
	apb = area_triangle(a[0], a[1], p[0], p[1], b[0], b[1])
	bpc = area_triangle(b[0], b[1], p[0], p[1], c[0], c[1])
	cpd = area_triangle(c[0], c[1], p[0], p[1], d[0], d[1])
	dpa = area_triangle(d[0], d[1], p[0], p[1], a[0], a[1])
	triangle_sum = apb + bpc + cpd + dpa
	return almost_equal(triangle_sum, area_square, 1e-05)
(cols, rows) = map(int, input().split())
(ccol, crow, cr) = map(int, input().split())
(scol1, srow1, scol3, srow3) = map(int, input().split())
for row in range(rows):
	for col in range(cols):
		s = '.'
		if in_circle(col, row, ccol, crow, cr):
			s = '#'
		if in_square(col, row, scol1, srow1, scol3, srow3):
			s = '#'
		print(s, end='')
	print()


from math import cos, atan2, pi, sin
inf = float('inf')
read_ints = lambda : list(map(int, input().split()))

def dot(U, V):
	return U[0] * V[0] + U[1] * V[1]

def vec(U, V):
	return (V[0] - U[0], V[1] - U[1])

def inside_circle(xc, yc, r, x, y):
	return (xc - x) ** 2 + (yc - y) ** 2 <= r ** 2

def inside_square(A, B, C, D, P):
	AP = vec(A, P)
	AB = vec(A, B)
	AD = vec(A, D)
	t1 = dot(AP, AB)
	t2 = dot(AP, AD)
	return (0 <= t1 and t1 <= dot(AB, AB)) and (0 <= t2 and t2 <= dot(AD, AD))
(w, h) = read_ints()
(xc, yc, r) = read_ints()
(x1, y1, x2, y2) = read_ints()
A = (x1, y1)
C = (x2, y2)
M = ((x1 + x2) / 2, (y1 + y2) / 2)
MA = vec(M, A)
MB = (-MA[1], MA[0])
B = (M[0] + MB[0], M[1] + MB[1])
D = (M[0] - MB[0], M[1] - MB[1])
M = [['.'] * w for _ in range(h)]
for y in range(h):
	for x in range(w):
		if inside_square(A, B, C, D, (x, y)) or inside_circle(xc, yc, r, x, y):
			M[y][x] = '#'
print('\n'.join([''.join(l) for l in M]))


import sys
import math

def sq(x1, y1, x3, y3):
	y4 = (y1 + y3 - (x1 - x3)) / 2
	y2 = x1 - x3 + y4
	x2 = (x1 + x3 - (y1 - y3)) / 2
	x4 = y1 - y3 + x2
	return ([(x1, y1), (x2, y2), (x3, y3), (x4, y4)], [(x2 - x1, y2 - y1), (x3 - x2, y3 - y2), (x4 - x3, y4 - y3), (x1 - x4, y1 - y4)])

def in_circle(xc, yc, r, x, y):
	return math.sqrt((xc - x) ** 2 + (yc - y) ** 2) <= r

def ve_mu(a1, a2):
	return a1[0] * a2[1] - a1[1] * a2[0]

def in_sq(ps, v, p):
	vs = [(p[0] - i[0], p[1] - i[1]) for i in ps]
	mul = [ve_mu(i, j) for (i, j) in zip(v, vs)]
	return len([i for i in mul if i >= 0]) == 4
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
(ps, v) = sq(x1, y1, x3, y3)
for row in range(0, h):
	for c in range(0, w):
		if in_circle(circleX, circleY, r, c, row) or in_sq(ps, v, (c, row)):
			print('#', end='')
		else:
			print('.', end='')
	print('')


import sys
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(cx, cy, cr) = input().strip().split(' ')
(cx, cy, cr) = [int(cx), int(cy), int(cr)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
xcenter = (x1 + x3) / 2
ycenter = (y1 + y3) / 2
xdiagonal = (x1 - x3) / 2
ydiagonal = (y1 - y3) / 2
x2 = xcenter - ydiagonal
y2 = ycenter + xdiagonal
x4 = xcenter + ydiagonal
y4 = ycenter - xdiagonal
x21 = x2 - x1
y21 = y2 - y1
x41 = x4 - x1
y41 = y4 - y1
for y in range(h):
	for x in range(w):
		point = True
		if (x - x1) * x21 + (y - y1) * y21 < 0.0:
			point = False
		if (x - x2) * x21 + (y - y2) * y21 > 0.0:
			point = False
		if (x - x1) * x41 + (y - y1) * y41 < 0.0:
			point = False
		if (x - x4) * x41 + (y - y4) * y41 > 0.0:
			point = False
		if (x - cx) ** 2 + (y - cy) ** 2 <= cr ** 2 or point:
			print('#', end='')
		else:
			print('.', end='')
	print()


import sys

def inCircle(x, y):
	return (x - circleX) ** 2 + (y - circleY) ** 2 <= r ** 2

def psf(s, a, b, x):
	return s * x - s * a + b

def inSquare(x, y):
	if issq:
		return x >= a1 and x <= a4 and (y >= b2) and (y <= b4)
	else:
		return y + 1e-14 >= psf12(x) and y + 1e-14 >= psf23(x) and (y - 1e-14 <= psf34(x)) and (y - 1e-14 <= psf41(x))
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
issq = False
dx = x3 - x1
dy = y3 - y1
if dx == 0 or dy == 0:
	if dx == 0:
		y2 = y4 = (y1 + y3) / 2
		x2 = x1 + (y1 - y3) / 2
		x4 = x1 - (y1 - y3) / 2
		(a1, b1) = (min(x2, x4), y2)
		(a2, b2) = (x1, min(y1, y3))
		(a3, b3) = (max(x2, x4), y4)
		(a4, b4) = (x3, max(y1, y3))
	else:
		x2 = x4 = (x1 + x3) / 2
		y2 = y1 + (x1 - x3) / 2
		y4 = y1 - (x1 - x3) / 2
		(a1, b1) = (min(x1, x3), y1)
		(a2, b2) = (x2, min(y2, y4))
		(a3, b3) = (max(x1, x3), y3)
		(a4, b4) = (x4, max(y2, y4))
	s12 = (b2 - b1) / (a2 - a1)
	s23 = (b3 - b2) / (a3 - a2)
	s34 = (b4 - b3) / (a4 - a3)
	s41 = (b1 - b4) / (a1 - a4)
	psf12 = lambda x: psf(s12, a1, b1, x)
	psf23 = lambda x: psf(s23, a2, b2, x)
	psf34 = lambda x: psf(s34, a3, b3, x)
	psf41 = lambda x: psf(s41, a4, b4, x)
else:
	dmidx = dx / 2
	dmidy = dy / 2
	midx = (x1 + x3) / 2
	midy = (y1 + y3) / 2
	x2 = midx - dmidy
	y2 = midy + dmidx
	x4 = midx + dmidy
	y4 = midy - dmidx
	l = [(x1, y1), (x2, y2), (x3, y3), (x4, y4)]
	if abs(dx) == abs(dy):
		l.sort()
		(a1, b1) = l[1]
		(a2, b2) = l[0]
		(a3, b3) = l[2]
		(a4, b4) = l[3]
		issq = True
	else:
		a1 = min(x1, x2, x3, x4)
		b2 = min(y1, y2, y3, y4)
		a3 = max(x1, x2, x3, x4)
		b4 = max(y1, y2, y3, y4)
		b1 = [item for item in l if item[0] == a1][0][1]
		a2 = [item for item in l if item[1] == b2][0][0]
		b3 = [item for item in l if item[0] == a3][0][1]
		a4 = [item for item in l if item[1] == b4][0][0]
		s12 = (b2 - b1) / (a2 - a1)
		s23 = (b3 - b2) / (a3 - a2)
		s34 = (b4 - b3) / (a4 - a3)
		s41 = (b1 - b4) / (a1 - a4)
		psf12 = lambda x: psf(s12, a1, b1, x)
		psf23 = lambda x: psf(s23, a2, b2, x)
		psf34 = lambda x: psf(s34, a3, b3, x)
		psf41 = lambda x: psf(s41, a4, b4, x)
result = [['.' for _ in range(w)] for _ in range(h)]
for x in range(w):
	for y in range(h):
		if inCircle(x, y):
			result[y][x] = '#'
			continue
		if inSquare(x, y):
			result[y][x] = '#'
for x in result:
	print(''.join(x))


import sys
import math

def distance(x1, y1, x2, y2):
	return math.hypot(x2 - x1, y2 - y1)

def shoelace(x1, y1, x2, y2, x3, y3):
	return abs(x1 * y2 + x2 * y3 + x3 * y1 - x2 * y1 - x3 * y2 - x1 * y3) / 2
(w, h) = input().strip().split(' ')
(w, h) = [int(w), int(h)]
(circleX, circleY, r) = input().strip().split(' ')
(circleX, circleY, r) = [int(circleX), int(circleY), int(r)]
(x1, y1, x3, y3) = input().strip().split(' ')
(x1, y1, x3, y3) = [int(x1), int(y1), int(x3), int(y3)]
square_mid_x = round((x1 + x3) / 2, 8)
square_mid_y = round((y1 + y3) / 2, 8)
half_diag_x = round((x1 - x3) / 2, 8)
half_diag_y = round((y1 - y3) / 2, 8)
x2 = square_mid_x - half_diag_y
y2 = square_mid_y + half_diag_x
x4 = square_mid_x + half_diag_y
y4 = square_mid_y - half_diag_x
side_length = distance(x1, y1, x2, y2)
square_area = round(side_length * side_length, 6)
for y_coord in range(h):
	for x_coord in range(w):
		a_tri_area = shoelace(x1, y1, x2, y2, x_coord, y_coord)
		b_tri_area = shoelace(x2, y2, x3, y3, x_coord, y_coord)
		c_tri_area = shoelace(x3, y3, x4, y4, x_coord, y_coord)
		d_tri_area = shoelace(x4, y4, x1, y1, x_coord, y_coord)
		if distance(x_coord, y_coord, circleX, circleY) <= r and r > 0 or (round(a_tri_area + b_tri_area + c_tri_area + d_tri_area, 8) <= square_area and square_area > 0):
			print('#', end='')
		else:
			print('.', end='')
	print()