Given two points and in a two-dimensional plane, if we move in a straight line from the first to the second point we advance in one of the following directions: N (north), S (south), E (east), W (west), NE (northeast), NW (northwest), SE (southeast), SW (southwest). For example:
If we move from (0, 0) to (0, 5) we advance in the N direction;
If we move from (0, 5) to (0, 0) we advance in the S direction;
If we move from (0, 0) to (3, 4) we advance in the NE direction;
If we move from (3, 4) to (0, 0) we advance in the SW direction.
Given a sequence of pairs of points, we want to know, for each pair, the direction in which we move going from the first to the second point.
The input starts with a non-negative integer . Then, it follows a sequence of quartets of integers representing the pair of points and . Assume that and are different.
For each pair of points and in the input sequence, the program outputs the direction in which we move when going from to . Follow the format of the examples.
Author: Emma Rollón
Generation: 2026-01-25T22:29:10.921Z
© Jutge.org, 2006–2026.
https://jutge.org