def solve():
# 读取初始状态
grid = [list(input().strip()) for _ in range(4)]
min_operations = float('inf')
best_sequence = []
# 遍历所有可能的操作组合 (2^16种可能)
for mask in range(1 << 16):
operations = []
temp_grid = [row.copy() for row in grid]
count = 0
# 解码mask中的每一位,决定是否操作(i,j)
for i in range(4):
for j in range(4):
if mask & (1 << (i * 4 + j)):
# 操作(i,j)
operations.append((i+1, j+1)) # 题目中是1-based
count += 1
# 翻转第i行和第j列
for k in range(4):
temp_grid[i][k] = '+' if temp_grid[i][k] == '-' else '-'
temp_grid[k][j] = '+' if temp_grid[k][j] == '-' else '-'
# (i,j)被翻转了两次,需要再翻转回来
temp_grid[i][j] = '+' if temp_grid[i][j] == '-' else '-'
# 检查是否全部打开
all_open = True
for row in temp_grid:
for c in row:
if c != '-':
all_open = False
break
if not all_open:
break
if all_open and count < min_operations:
min_operations = count
best_sequence = operations.copy()
elif all_open and count == min_operations:
# 按照字典序比较,选择更小的
if operations < best_sequence:
best_sequence = operations.copy()
print(min_operations)
for op in best_sequence:
print(op[0], op[1])
solve()