# PROBLEM LINK:

Contest Division 1

Contest Division 2

Contest Division 3

Contest Division 4

**Setter:** utkarsh_adm

**Testers:** iceknight1093, tabr

**Editorialist:** hrishik85

# DIFFICULTY:

TBD

# PREREQUISITES:

None

# PROBLEM:

We are given a 10 x 10 grid with rows number 1 to 10 from top to bottom and columns numbered 1 to 10 from left to right. Each cell is defined by (r, c) where r is the row number and c is the column number. Chef can move from any (a, b) to any (c, d) within this grid as long as

- a not equal to c OR
- b not equal to d

# EXPLANATION:

This is an implementation problem to check basic programming skills and logic.

- We know that we can move from ANY (a, b) to ANY (c, d) within the grid as long as the conditions are satisfied.
- Distance here is not a constraint - we can move from one corner of the grid to another in a single step.

What do the 2 points above tell us? We should be able to move to any other point in the grid -

- In 1 step if the point meets the condition such that (a not equal to c) and (b not equal to d)
- In 2 steps if the point meets the condition such that (a equal to c) or (b equal to d). In this case, in the 1st step - we will move to an intermediate point (e, f) such that (a not equal to e) or (b not equal to f). From that point, we will move to (c, d)

# TIME COMPLEXITY:

Time complexity is O(1).

# SOLUTION:

## Editorialist's Solution

```
t=int(input())
for _ in range(t):
sx, sy, ex, ey = map(int,input().split())
if sx==ex or sy==ey:
print(2)
else:
print(1)
```