I don't see what the problem would be with your program. It seems to me it works fine. Could you provide an input where it does not work as expected?
Also, it is a good idea to have a proper problem description. E.g. This is a chess problem. We would like to see if the king chess piece can move from one cell to another. Both coordinates of the start and end cells are indexed by numbers.
I've changed your code a bit, made the user input more talkative and changed the variable names to more meaningful ones. Added some comments and simplified the check if the destination (end) cell is right next to the king's current location, i.e. their relative distance (offset) from one another is no more than 1 cell in either direction:
# User input
startX = int(input('startX: '))
startY = int(input('startY: '))
endX = int(input('endX: '))
endY = int(input('endY: '))
# Decision making
offsetX = abs(startX - endX)
offsetY = abs(startY - endY)
if (offsetX <= 1 and offsetY <= 1):
print('YES')
else:
print('NO')