##Katherine Ryan
##3/12/2020
##Int5
#Enloe
#Potter
#Contest 3

filename = 'F:\\3int.txt'
##filename = 'intContest3.txt'
inputs = []
with open(filename) as file_object:
   for line in file_object:
        inputs.append(line)
for x in range(len(inputs)-1): ##need to do -1 if the last line does not have newline
    inputs[x] = inputs[x][:len(inputs[x])-1]##this removes the new line chars from the string

Akey= [[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1]]
Bkey= [[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3]]
Ckey= [[0,1],[0,2],[1,1],[1,2],[2,1],[2,2],[3,1],[3,2]]
Dkey= [[1,0],[2,1],[1,2],[2,3],[2,0],[1,1],[2,2],[1,3]]


def fill (matrix, passed):
    for x in range(4):
        for y in range(4):
            if([x,y] in passed):
                matrix[x,y] = 1
def fillNot (matrix, passed):
    for x in range(4):
        for y in range(4):
            if([x,y] not in passed):
                matrix[x,y]=1
def remove (matrix, passed, locked):
    for x in range(4):
        for y in range(4):
            if([x,y] not in passed and [x,y] not in locked):
                matrix[x,y]=0

def removeNot (matrix, passed,locked):
    for x in range(4):
        for y in range(4):
            if([x,y] in passed and [x,y] not in locked):
                matrix[x,y]=0

for i in range(len(inputs)):
    currentElem = str(inputs[i])
    items = []
    x = 0
    while x