AoC Day 11

In [1]:
def readfile(path):
    with open(path) as input_file: 
        return input_file.read().strip()
In [2]:
def params(program, i, count):
    modes = str(program[i] // 100)[::-1]
    result = []
    
    for x in range(count - 1):
        arg = program[i + 1 + x]
        if x >= len(modes) or modes[x] == "0":
            result.append(program[arg])
        elif modes[x] == "2":
            result.append(program[program.offset + arg])
        else:
            result.append(arg)
            
    output = program[i + count]
    if len(modes) >= count and modes[count - 1] == "2":
        output += program.offset
        
    result.append(output) # output
    return result
In [3]:
def add(program, i, **kwargs):
    assert program[i] % 100 == 1
    a, b, out = params(program, i, 3)
    program[out] = a + b
    return i + 4, None
    
def mul(program, i, **kwargs):
    assert program[i] % 100 == 2
    a, b, out = params(program, i, 3)
    program[out] = a * b
    return i + 4, None

def inp(program, i, input_values, **kwargs):
    assert program[i] % 100 == 3
    out, = params(program, i, 1)
    program[out] = input_values.pop(0)
    # print(f"> program[{out}] = {program[out]}")
    return i + 2, None

def out(program, i, **kwargs):
    assert program[i] % 100 == 4
    val, _ = params(program, i, 2)
    # print(f"> {val}")
    return i + 2, val
    
def jit(program, i, **kwargs):
    assert program[i] % 100 == 5
    test, ip, _ = params(program, i, 3)
    if test != 0:
        return ip, None
    return i + 3, None

def jif(program, i, **kwargs):
    assert program[i] % 100 == 6
    test, ip, _ = params(program, i, 3)
    if test == 0:
        return ip, None
    return i + 3, None

def lt(program, i, **kwargs):
    assert program[i] % 100 == 7
    a, b, out = params(program, i, 3)
    program[out] = int(a < b)
    return i + 4, None

def eq(program, i, **kwargs):
    assert program[i] % 100 == 8
    a, b, out = params(program, i, 3)
    program[out] = int(a == b)
    return i + 4, None

def rbo(program, i, **kwargs):
    assert program[i] % 100 == 9
    delta, _ = params(program, i, 2)
    program.offset += delta
    # print (f"> rbo = {program.offset}" )
    return i + 2, None

operations = { 1: add, 2: mul, 3: inp, 4: out, 5: jit, 6: jif, 7: lt, 8: eq, 9: rbo }
In [4]:
class Program(list):
    def __init__(self, *args, **kwargs):
        super(Program, self).__init__(args[0])
        self.offset = 0

def compute(program, input_values, debug=False):
    program = Program(program)
    
    l = len(program)
    i = 0
    output_value = None
    last_output = None
    
    while i < l:
        op = program[i]
        if op == 99:
            if debug: 
                print(f">> exit {output_value}")
            return 
        
        if debug:
            print(f">> {i}, {list(enumerate(program))[i:i+5]}")
            
        i, output_value = operations[op % 100](program, i, input_values=input_values)
        
        if output_value is not None:
            yield output_value
        
    raise Exception("Didn't terminate properly")
    
def process(listing):
    lst = list(map(int, listing.split(",")))
    lst.extend([0] * 100000)
    return lst
In [15]:
it = compute(process(readfile("AoC/input11.txt")), input_values=[1, 0, 1, 0])
In [113]:
from collections import defaultdict

left = { 
    (0, -1): (-1, 0), 
    (-1, 0): (0, 1), 
    (0, 1): (1, 0), 
    (1, 0): (0, -1),
}
right = {v: k for k, v in left.items()}

def painter(start=0, debug=False, limit=100):
    input_values = []
    it = compute(process(readfile("AoC/input11.txt")), input_values=input_values)
    
    grid = {}
    x = 0
    y = 0
    
    dx = 0
    dy = -1
    
    index = 0
    while True and (not debug or (not limit or index <= limit)):
        index += 1
        try:
            input_values.append(grid.get((x, y), start if index == 1 else 0))
            grid[(x, y)] = (dx, dy)
            
            if debug:
                print_grid(grid)
            
            col = next(it)
            grid[(x, y)] = col
            
            turn = next(it)
            dx, dy = left[(dx, dy)] if turn == 0 else right[(dx, dy)]
            
            x += dx
            y += dy
            
            if debug:
                print(col, turn)
                print()
        except StopIteration:
            break
            
    return grid
In [114]:
def print_grid(grid):
    minx, maxx = min(grid.keys(), key=lambda x: x[0])[0], max(grid.keys(), key=lambda x: x[0])[0]
    miny, maxy = min(grid.keys(), key=lambda x: x[1])[1], max(grid.keys(), key=lambda x: x[1])[1]
    for j in range(miny, maxy + 1):
        for i in range(minx, maxx + 1):
            val = grid.get((i, j), 0)
            ch = ' '
            if val == 1:
                ch = '#'
            elif val == (0, 1):
                ch = 'v'
            elif val == (0, -1):
                ch = '^'
            elif val == (1, 0):
                ch = '>'
            elif val == (-1, 0):
                ch = '<'
            print(ch, end='')
        print()
In [115]:
len(painter())
Out[115]:
1964
In [116]:
print_grid(painter(start=1))
 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  # #  > 
 #    #  # #### #  #  ##  #    #  # #  #   
In [117]:
print_grid(painter(start=0))
                                       ##  # #                                            
                                     #  # ####                                            
                               ##     ##    ##                                            
                              # ## #     ##  # #                                          
                             ## ##   #  #      ##                                         
                            ###  #    ### #   ##                                          
                            ## #  ##    ## # ####                                         
                             ##  ##    ####                                               
                                        #  ###                                            
                               ##     ##### #                                             
             ##    ##    #####  #     ## # #                                              
           ####   # #   ###   ###        ### #                                            
            # #  # #    ##    # ###        # #                                            
        ## ## # ###  ##  # ##   ###       #  #                                            
        # ## # # #     ##   ## #  #       #  #                 ##                         
   ## # ##    # # ### #   ##    ###       # #                ##                           
    ##  #   # # ## ##  #  # ## ## #       # ## #   # #   ###  ###                         
   #  # #####  ###### # ##   # ##  #      # ## #    #### #     # ##                       
   ## ####   #       ####### #   ###      ### #  # ###   #   #    ##                      
  ### #     # #  #  #  # ##  ## #            ##   #######   ##  ## #                      
 ##  ##       ## ###### # ## #####                ######## ####                           
  ##   ##    ## ## #  #     # ###            # #### #  # # ########                       
##  >###     #### ###  ##   #                 #   #####    ## ### ###                     
#   #              #     #  # #               #  #   #  ###   #  # # #                    
  # #  # #        #    #  #   ###              ######  #  #   #### # #                    
   ##  # #        ### ###  #### # #             #####  ### ## # ## #                      
    #   #           #  #    #  # ##            # ##  #     ##   #   #          ##         
     # #             ##     #   #              #  #   # # # # #  ## # ##      #     #     
                               ##              #  #   #  ######  #    # ###  # ### ##     
                                              ### #  # #  ## ##  #  ## ## # # #  ##       
                                           ####  ### # #  #  #   #  ## #  # # #    # # ## 
                                            ## #     ## # # ## # #  # ## # # # ###  ### # 
                                           # ### ####   # #    ## #   #   # ##  ##     #  
                                          ### #   #  #    ## #  ## #   # # #  # #### # #  
                                         #  #  ###     ## #  # # # ## #  ### # #  ## ## # 
                                         # #  #  #   # #  #  ### #### #  ######  ### #  # 
                                              ## ##  ####  #### #### ## ##   ## #   ##  # 
                                          #  ## ######     ###   ##   ##  # ####     #####
                                            # # ##   #    ## ## ###  ## ##    ##    ######
                                              ## ##  # ####   # # ##   #    # #    ##  ## 
                                            #    #   #### ####   # #  ####### #           
                                             # ### ### ## #    ###  #  #   #              
                                             ##  #  #  #   ######    #### ## #            
                                                 # #   # #    ##  #  ## ##  #             
                                                 # ## ####### ####      #  #              
                                                 ##### ## ### # # ##     ##               
                                                   ### #  # ##   ## ## #    ##            
                                                   #    #  ##   ### # ##  #  #            
                                                   #  # ## # ####   # #    #  ##          
                                                  #  ### #   # #    #       #   #         
                                                        ## ##  ## ######     ####         
                                                   ##  ## ### #   #  # # #   ## ##        
                                                       ####  #  #####   ##### ## #        
                                                        #   ##  #####  #  ### #  #        
                                                         #  # # ##### # ###   ####        
                                                        # # ## # #   #####  #             
                                                       # # ### # #        ###             
                                                       #  ###  ##    ##  ##               
                                                       ## # #   #### ### #                
                                                       #### #    # # # # #                
                                                        #  ###   ###### # #               
                                                           ##   ##       ##               
                                                          ####  ####                      
                                                          #  #  # #                       
                                                          #  #                            
                                                           ##                             
In [119]:
_ = painter(start=0, debug=True, limit=20)
^
1 0

<#
1 1

^ 
##
1 0

<# 
 ##
1 1

^  
## 
 ##
1 1

#> 
## 
 ##
1 0

 ^ 
## 
## 
 ##
1 1

 #>
## 
## 
 ##
1 0

  ^
 ##
## 
## 
 ##
1 1

  #>
 ## 
##  
##  
 ## 
1 0

   ^
  ##
 ## 
##  
##  
 ## 
1 0

  <#
  ##
 ## 
##  
##  
 ## 
1 1

  ^ 
  ##
  ##
 ## 
##  
##  
 ## 
1 1

  #>
  ##
  ##
 ## 
##  
##  
 ## 
1 1

  ##
  #v
  ##
 ## 
##  
##  
 ## 
0 0

  ## 
  # >
  ## 
 ##  
##   
##   
 ##  
1 1

  ## 
  # #
  ##v
 ##  
##   
##   
 ##  
1 1

  ## 
  # #
  #<#
 ##  
##   
##   
 ##  
0 0

  ## 
  # #
  # #
 ##v 
##   
##   
 ##  
1 1

  ## 
  # #
  # #
 #<# 
##   
##   
 ##  
0 0

  ## 
  # #
  # #
 # # 
##v  
##   
 ##  
1 1

In [121]:
_ = painter(start=1, debug=True, limit=None)
^
0 1

 >
1 1

 #
 v
1 0

 # 
 #>
0 0

 #^
 # 
1 1

 ##>
 #  
1 1

 ###
 # v
0 0

 ### 
 #  >
0 0

 ###^
 #   
1 1

 ####>
 #    
0 1

 #### 
 #   v
0 0

 ####  
 #    >
1 0

 #### ^
 #    #
1 1

 #### #>
 #    # 
0 1

 #### # 
 #    #v
0 0

 #### #  
 #    # >
1 0

 #### # ^
 #    # #
0 1

 #### #  >
 #    # # 
1 1

 #### #  #
 #    # #v
0 0

 #### #  # 
 #    # # >
0 0

 #### #  #^
 #    # #  
0 1

 #### #  # >
 #    # #   
1 1

 #### #  # #
 #    # #  v
1 0

 #### #  # # 
 #    # #  #>
0 0

 #### #  # #^
 #    # #  # 
1 1

 #### #  # ##>
 #    # #  #  
1 1

 #### #  # ###
 #    # #  # v
0 0

 #### #  # ### 
 #    # #  #  >
0 0

 #### #  # ###^
 #    # #  #   
1 1

 #### #  # ####>
 #    # #  #    
0 1

 #### #  # #### 
 #    # #  #   v
0 0

 #### #  # ####  
 #    # #  #    >
1 0

 #### #  # #### ^
 #    # #  #    #
1 1

 #### #  # #### #>
 #    # #  #    # 
0 1

 #### #  # #### # 
 #    # #  #    #v
0 0

 #### #  # #### #  
 #    # #  #    # >
1 0

 #### #  # #### # ^
 #    # #  #    # #
0 1

 #### #  # #### #  >
 #    # #  #    # # 
1 1

 #### #  # #### #  #
 #    # #  #    # #v
0 0

 #### #  # #### #  # 
 #    # #  #    # # >
0 0

 #### #  # #### #  #^
 #    # #  #    # #  
0 1

 #### #  # #### #  # >
 #    # #  #    # #   
0 1

 #### #  # #### #  #  
 #    # #  #    # #  v
1 0

 #### #  # #### #  #   
 #    # #  #    # #  #>
0 0

 #### #  # #### #  #  ^
 #    # #  #    # #  # 
1 1

 #### #  # #### #  #  #>
 #    # #  #    # #  #  
1 1

 #### #  # #### #  #  ##
 #    # #  #    # #  # v
0 0

 #### #  # #### #  #  ## 
 #    # #  #    # #  #  >
1 0

 #### #  # #### #  #  ##^
 #    # #  #    # #  #  #
0 1

 #### #  # #### #  #  ## >
 #    # #  #    # #  #  # 
0 1

 #### #  # #### #  #  ##  
 #    # #  #    # #  #  #v
0 0

 #### #  # #### #  #  ##   
 #    # #  #    # #  #  # >
1 0

 #### #  # #### #  #  ##  ^
 #    # #  #    # #  #  # #
1 1

 #### #  # #### #  #  ##  #>
 #    # #  #    # #  #  # # 
1 1

 #### #  # #### #  #  ##  ##
 #    # #  #    # #  #  # #v
0 0

 #### #  # #### #  #  ##  ## 
 #    # #  #    # #  #  # # >
0 0

 #### #  # #### #  #  ##  ##^
 #    # #  #    # #  #  # #  
1 1

 #### #  # #### #  #  ##  ###>
 #    # #  #    # #  #  # #   
1 1

 #### #  # #### #  #  ##  ####
 #    # #  #    # #  #  # #  v
0 0

 #### #  # #### #  #  ##  #### 
 #    # #  #    # #  #  # #   >
0 0

 #### #  # #### #  #  ##  ####^
 #    # #  #    # #  #  # #    
0 1

 #### #  # #### #  #  ##  #### >
 #    # #  #    # #  #  # #     
1 1

 #### #  # #### #  #  ##  #### #
 #    # #  #    # #  #  # #    v
1 0

 #### #  # #### #  #  ##  #### # 
 #    # #  #    # #  #  # #    #>
0 0

 #### #  # #### #  #  ##  #### #^
 #    # #  #    # #  #  # #    # 
1 1

 #### #  # #### #  #  ##  #### ##>
 #    # #  #    # #  #  # #    #  
1 1

 #### #  # #### #  #  ##  #### ###
 #    # #  #    # #  #  # #    # v
0 0

 #### #  # #### #  #  ##  #### ### 
 #    # #  #    # #  #  # #    #  >
1 0

 #### #  # #### #  #  ##  #### ###^
 #    # #  #    # #  #  # #    #  #
0 1

 #### #  # #### #  #  ##  #### ### >
 #    # #  #    # #  #  # #    #  # 
0 1

 #### #  # #### #  #  ##  #### ###  
 #    # #  #    # #  #  # #    #  #v
0 0

 #### #  # #### #  #  ##  #### ###   
 #    # #  #    # #  #  # #    #  # >
1 0

 #### #  # #### #  #  ##  #### ###  ^
 #    # #  #    # #  #  # #    #  # #
1 1

 #### #  # #### #  #  ##  #### ###  #>
 #    # #  #    # #  #  # #    #  # # 
0 1

 #### #  # #### #  #  ##  #### ###  # 
 #    # #  #    # #  #  # #    #  # #v
0 0

 #### #  # #### #  #  ##  #### ###  #  
 #    # #  #    # #  #  # #    #  # # >
1 0

 #### #  # #### #  #  ##  #### ###  # ^
 #    # #  #    # #  #  # #    #  # # #
0 1

 #### #  # #### #  #  ##  #### ###  #  >
 #    # #  #    # #  #  # #    #  # # # 
1 1

 #### #  # #### #  #  ##  #### ###  #  #
 #    # #  #    # #  #  # #    #  # # #v
0 0

 #### #  # #### #  #  ##  #### ###  #  # 
 #    # #  #    # #  #  # #    #  # # # >
0 0

 #### #  # #### #  #  ##  #### ###  #  #^
 #    # #  #    # #  #  # #    #  # # #  
0 1

 #### #  # #### #  #  ##  #### ###  #  # >
 #    # #  #    # #  #  # #    #  # # #   
0 1

 #### #  # #### #  #  ##  #### ###  #  #  
 #    # #  #    # #  #  # #    #  # # #  v
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #   >
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                          v
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                         < 
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                           
                                         v 
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                           
                                        <  
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                        ^  
                                           
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                       <   
                                           
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                           
                                       v   
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                           
                                      <    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                      ^    
                                      #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                     <     
                                      #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                     #     
                                     v#    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                     #     
                                    < #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                    ^#     
                                    # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                   <##     
                                    # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                    ##     
                                   v# #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                    ##     
                                  < # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                  ^ ##     
                                    # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                 <# ##     
                                    # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                  # ##     
                                 v  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                  # ##     
                                <#  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                                ^ # ##     
                                ##  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                               <  # ##     
                                ##  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                               #  # ##     
                               v##  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                               #  # ##     
                              <###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                              ^#  # ##     
                               ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                             < #  # ##     
                               ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                               #  # ##     
                             v ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                               #  # ##     
                            <  ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                            ^  #  # ##     
                               ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                           <#  #  # ##     
                               ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                           ##  #  # ##     
                           v   ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                           ##  #  # ##     
                          <    ###  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                          ^##  #  # ##     
                          #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                         <###  #  # ##     
                          #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                          ###  #  # ##     
                         v#    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                          ###  #  # ##     
                        < #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                        ^ ###  #  # ##     
                          #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                       <  ###  #  # ##     
                          #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                          ###  #  # ##     
                       v  #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                          ###  #  # ##     
                      <   #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                      ^   ###  #  # ##     
                          #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                     <    ###  #  # ##     
                          #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                     #    ###  #  # ##     
                     v    #    ###  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                     #    ###  #  # ##     
                    <#    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                    ^#    ###  #  # ##     
                     #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                   < #    ###  #  # ##     
                     #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                     #    ###  #  # ##     
                   v #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                     #    ###  #  # ##     
                  <  #    #    ###  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                  ^  #    ###  #  # ##     
                  #  #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                 <   #    ###  #  # ##     
                  #  #    #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                 #   #    ###  #  # ##     
                 v#  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                 #   #    ###  #  # ##     
                < #  #    #    ###  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                ^#   #    ###  #  # ##     
                # #  #    #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
               <##   #    ###  #  # ##     
                # #  #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                ##   #    ###  #  # ##     
               v# #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
                ##   #    ###  #  # ##     
              < # #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
              ^ ##   #    ###  #  # ##     
                # #  #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
             <  ##   #    ###  #  # ##     
                # #  #    #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
             #  ##   #    ###  #  # ##     
             v  # #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
             #  ##   #    ###  #  # ##     
            <   # #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
            ^#  ##   #    ###  #  # ##     
                # #  #    #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
           <##  ##   #    ###  #  # ##     
                # #  #    #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
           ###  ##   #    ###  #  # ##     
           v    # #  #    #    ###  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
           ###  ##   #    ###  #  # ##     
          <#    # #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
          ^###  ##   #    ###  #  # ##     
           #    # #  #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
         < ###  ##   #    ###  #  # ##     
           #    # #  #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
           ###  ##   #    ###  #  # ##     
         v #    # #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
           ###  ##   #    ###  #  # ##     
        <  #    # #  #    #    ###  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
        ^  ###  ##   #    ###  #  # ##     
        #  #    # #  #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
       <   ###  ##   #    ###  #  # ##     
        #  #    # #  #    #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
       #   ###  ##   #    ###  #  # ##     
       v#  #    # #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
       #   ###  ##   #    ###  #  # ##     
      < #  #    # #  #    #    ###  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
      ^#   ###  ##   #    ###  #  # ##     
      # #  #    # #  #    #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
     <##   ###  ##   #    ###  #  # ##     
      # #  #    # #  #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
      ##   ###  ##   #    ###  #  # ##     
     v# #  #    # #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
      ##   ###  ##   #    ###  #  # ##     
    < # #  #    # #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
    ^ ##   ###  ##   #    ###  #  # ##     
      # #  #    # #  #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
   <  ##   ###  ##   #    ###  #  # ##     
      # #  #    # #  #    #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
   #  ##   ###  ##   #    ###  #  # ##     
   v  # #  #    # #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
   #  ##   ###  ##   #    ###  #  # ##     
  <   # #  #    # #  #    #    ###  # #    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
  ^#  ##   ###  ##   #    ###  #  # ##     
      # #  #    # #  #    #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 <##  ##   ###  ##   #    ###  #  # ##     
      # #  #    # #  #    #    ###  # #    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 v    # #  #    # #  #    #    ###  # #    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
<#    # #  #    # #  #    #    ###  # #    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
v                                          
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 >                                         
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #                                         
 v                                         
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #                                         
 #>                                        
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #^                                        
 #                                         
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 # >                                       
 #                                         
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #                                         
 # v                                       
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #                                         
 #  >                                      
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #  ^                                      
 #                                         
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #   >                                     
 #                                         
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #                                         
 #   v                                     
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #                                         
 #    >                                    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    ^                                    
 #    #                                    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    #>                                   
 #    #                                    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    #                                    
 #    #v                                   
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    #                                    
 #    # >                                  
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # ^                                  
 #    #                                    
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #>                                 
 #    #                                    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #                                  
 #    #  v                                 
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #                                  
 #    #  #>                                
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # # ^                                
 #    #  #                                 
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  >                               
 #    #  #                                 
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #                               
 #    #  # v                               
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #                               
 #    #  # #>                              
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #^                              
 #    #  # ##                              
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  # >                             
 #    #  # ##                              
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #                               
 #    #  # ##v                             
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #                               
 #    #  # ###>                            
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #  ^                            
 #    #  # ####                            
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #   >                           
 #    #  # ####                            
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #                               
 #    #  # ####v                           
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #                               
 #    #  # #### >                          
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    ^                          
 #    #  # #### #                          
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    #>                         
 #    #  # #### #                          
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    #                          
 #    #  # #### #v                         
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    #                          
 #    #  # #### # >                        
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # ^                        
 #    #  # #### #                          
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #>                       
 #    #  # #### #                          
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #                        
 #    #  # #### #  v                       
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #                        
 #    #  # #### #  #>                      
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # # ^                      
 #    #  # #### #  #                       
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  >                     
 #    #  # #### #  #                       
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #                     
 #    #  # #### #  # v                     
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #                     
 #    #  # #### #  #  >                    
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #^                    
 #    #  # #### #  #  #                    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  # >                   
 #    #  # #### #  #  #                    
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #                     
 #    #  # #### #  #  #v                   
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #                     
 #    #  # #### #  #  ##>                  
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  ^                  
 #    #  # #### #  #  ##                   
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  #>                 
 #    #  # #### #  #  ##                   
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  #                  
 #    #  # #### #  #  ## v                 
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  #                  
 #    #  # #### #  #  ##  >                
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # ^                
 #    #  # #### #  #  ##  #                
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #>               
 #    #  # #### #  #  ##  #                
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #                
 #    #  # #### #  #  ##  #v               
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #                
 #    #  # #### #  #  ##  # >              
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # # ^              
 #    #  # #### #  #  ##  #                
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #  >             
 #    #  # #### #  #  ##  #                
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #                
 #    #  # #### #  #  ##  #  v             
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #                
 #    #  # #### #  #  ##  #   >            
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #   ^            
 #    #  # #### #  #  ##  #                
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    >           
 #    #  # #### #  #  ##  #                
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    #           
 #    #  # #### #  #  ##  #    v           
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    #           
 #    #  # #### #  #  ##  #    #>          
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    #^          
 #    #  # #### #  #  ##  #    #           
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # >         
 #    #  # #### #  #  ##  #    #           
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #         
 #    #  # #### #  #  ##  #    # v         
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #         
 #    #  # #### #  #  ##  #    #  >        
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #^        
 #    #  # #### #  #  ##  #    #  #        
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # # >       
 #    #  # #### #  #  ##  #    #  #        
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #         
 #    #  # #### #  #  ##  #    #  #v       
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #         
 #    #  # #### #  #  ##  #    #  # >      
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  ^      
 #    #  # #### #  #  ##  #    #  # #      
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  #>     
 #    #  # #### #  #  ##  #    #  # #      
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  #      
 #    #  # #### #  #  ##  #    #  # #v     
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  #      
 #    #  # #### #  #  ##  #    #  # # >    
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  # ^    
 #    #  # #### #  #  ##  #    #  # #      
1 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  # #>   
 #    #  # #### #  #  ##  #    #  # #      
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  # #    
 #    #  # #### #  #  ##  #    #  # #  v   
1 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  # #    
 #    #  # #### #  #  ##  #    #  # #  #>  
0 0

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  # # ^  
 #    #  # #### #  #  ##  #    #  # #  #   
0 1

 #### #  # #### #  #  ##  #### ###  #  #   
 #    # #  #    # #  #  # #    #  # # #    
 ###  ##   ###  ##   #    ###  #  # ##     
 #    # #  #    # #  #    #    ###  # #    
 #    # #  #    # #  #  # #    # #  # #  > 
 #    #  # #### #  #  ##  #    #  # #  #