Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- a = []
- for i in range(8):
- a.append(list(map(int, input().split())))
- for i in range(7):
- mult = True
- for j in range(7):
- if a[i][j] // abs(a[i][j]) != a[i][j + 1] // abs(a[i][j + 1]):
- mult = False
- if mult == True:
- continue
- else:
- for j in range(8):
- if a[i][j] < 0:
- tmp1 = a[i + 1][j]
- tmp2 = a[i][j]
- a[i][j] = tmp1
- a[i + 1][j] = tmp2
- mult1 = True
- for k in range(7):
- if a[i][k] // abs(a[i][k]) != a[i][k + 1] // abs(a[i][k + 1]):
- mult1 = False
- if mult1 == True:
- break
- else:
- if j == 7:
- print("NO")
- sys.exit(0)
- print("YES")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement