// Arup Guha
// 7/13/2026
// Solution to 1994 UCF HSPT Problem: Where's the Bee?

import java.util.*;

public class beehive {
	
	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		
		/*** Note: The posted C solution doesn't do what the specification says. The
		           posted C solution places a blank line after the output for every
				   case, including the last one. The specification is clear though to
				   "Print a blank line between output for different data sets."
				   So I am just going to keep this in my posted solution. Also,
				   I have posted the output data based on my solution and not their
				   posted solution.
				   
				   Also, the posted C solution always prints 80 columns no matter what...
				   I just print the number of columns based on the input case.
		***/
		
		// This is annoying.
		boolean printBlank = false;
		
		// Process cases.
		while (stdin.hasNext()) {
		
			// To make between cases.
			if (printBlank) System.out.println();

			// Get the number of cells in each column.
			String line = stdin.nextLine();
			StringTokenizer tok = new StringTokenizer(line);
			int n = tok.countTokens();
			int[] size = new int[n];
			int maxRow = 0;
			
			// Extract sizes for each column.
			for (int i=0; i<n; i++) {
				size[i] = Integer.parseInt(tok.nextToken());
				maxRow = Math.max(maxRow, 2*size[i]+i%2);
			}
			
			// Correct grid size.
			char[][] g = new char[maxRow+1][2*n+1];
			
			// My default character.
			for (int i=0; i<g.length; i++) Arrays.fill(g[i], ' ');
				
			// Draw honeycombs.
			for (int i=0; i<n; i++)
				for (int j=0; j<size[i]; j++)
					drawHex(g, i, j);
			
			// Get number of queens.
			int nQ = Integer.parseInt(stdin.nextLine());
			for (int i=0; i<nQ; i++) {
				tok = new StringTokenizer(stdin.nextLine());
				int col = Integer.parseInt(tok.nextToken())-1;
				int row = Integer.parseInt(tok.nextToken())-1;
				drawQ(g, col, row);
			}
			
			// Prints grid.
			for (int i=0; i<g.length; i++)
				System.out.println(new String(g[i]));
			
			// Update this.
			printBlank = true;
		}
	}
	
	// Annoying - this draws the hexagon in g for column c, row r, 0 based.
	public static void drawHex(char[][] g, int c, int r) {
		g[2*r+c%2+1][2*c] = '/';
		g[2*r+c%2][2*c+1] = '_';
		g[2*r+c%2+1][2*c+2] = '\\';
		g[2*r+c%2+2][2*c] = '\\';
		g[2*r+c%2+2][2*c+1] = '_';
		g[2*r+c%2+2][2*c+2] = '/';
	}
	
	// Draws a Q in g at column c, row r.
	public static void drawQ(char[][] g, int c, int r) {
		g[2*r+c%2+1][2*c+1] = 'Q';
	}
	
}