In 1st second ‘O’ can kill the angel if the ‘A’ reaches the ogre’s location.
In the 2nd second, ‘O’ can kill if ‘A’ is in 8 surrounding cells.
In 3rd second ‘O’ can kill if ‘A’ reaches the ogre’s location.
In the 4th second, ‘O’ cannot kill ‘A’ in any condition.
This sequence repeats cyclically.
‘A’ is the same colored cell as ‘X’.
‘X’ is only active at the time equal row number of ‘X’.
Input:
'N' = 12
‘A’ = [12 11]
‘O’ = [3, 9]
‘X’ = [8, 4]
‘Z’ = [4, 3]
Output: [5, 11]
The Angel will be killed by the demon(‘X’) at 8th second as follows:

The first line will contain the integer 'T', the number of test cases. For each test case
In the first line of each test case, an integer ‘N’ denotes the size of the board.
The Next four lines contain two integers each denoting the coordinates of Angel(‘A’) and demons(‘O’, ‘X’, and ‘Z’) respectively.
For each test case, print the co-ordinating of the Angles death or print [-1, -1] if Angel successfully crosses the board.
You don't need to print anything. It has already been taken care of. Just implement the given function.
1 <= 'T' <= 10
5 <= 'N' <= 500
1 <= ‘A[i], A[j]’ <= ‘N’
1 <= ‘O[i], O[j]’ <= ‘N’
1 <= ‘X[i], X[j]’ <= ‘N’
1 <= ‘Z[i], Z[j]’ <= ‘N’
Where ‘i’ and ‘j’ represent the row and column respectively.
Time Limit: 1 sec
Approach:
Algorithm :