29 lines
501 B
Python
29 lines
501 B
Python
f = open('INPUT.TXT')
|
|
line = f.readline().strip().split()
|
|
f.close()
|
|
|
|
start = line[0]
|
|
end = line[1]
|
|
|
|
start_col = ord(start[0]) - ord('a')
|
|
start_row = int(start[1]) - 1
|
|
|
|
end_col = ord(end[0]) - ord('a')
|
|
end_row = int(end[1]) - 1
|
|
|
|
can_reach = False
|
|
|
|
if end_row > start_row:
|
|
diff_row = end_row - start_row
|
|
diff_col = abs(end_col - start_col)
|
|
|
|
if diff_row == diff_col:
|
|
can_reach = True
|
|
|
|
f = open('OUTPUT.TXT', 'w')
|
|
if can_reach:
|
|
f.write('YES')
|
|
else:
|
|
f.write('NO')
|
|
f.close()
|