# l = [[0, 0, 0, 2], [0, 0, 0, 2], [0, 0, 4, 8], [0 ,0, 4, 8]] com = int(input()) l=[] for _ in range(4): l.append(list(map(int,input().split()))) if com == 1: for i in range(3, 0, -1): for j in range(4): if l[i-1][j] == l[i][j]: l[i][j] = 0 ...