Initializing all four arrays
left = [ [ 0 for x in range ( N ) ] for y in range ( N ) ] NEW_LINE right = [ [ 0 for x in range ( N ) ] for y in range ( N ) ] NEW_LINE up = [ [ 0 for x in range ( N ) ] for y in range ( N ) ] NEW_LINE down = [ [ 0 for x in range ( N ) ] for y in range ( N ) ] NEW_LINE