#C3488. Final Car Coordinates

    ID: 46920 Type: Default 1000ms 256MiB

Final Car Coordinates

Final Car Coordinates

You are given a set of commands for cars. Each command consists of three integers: the initial coordinates (x, y) and a direction index (theta). Depending on the value of \(\theta\), the car moves one unit in one of the four cardinal directions:

  • \(\theta = 0\): move right (increase \(x\) by 1)
  • \(\theta = 1\): move up (increase \(y\) by 1)
  • \(\theta = 2\): move left (decrease \(x\) by 1)
  • \(\theta = 3\): move down (decrease \(y\) by 1)

Your task is to compute the final coordinates for each car after applying its respective command.

inputFormat

The input is provided via stdin and consists of multiple lines:

  1. The first line contains a single integer \(T\) representing the number of cars.
  2. Each of the next \(T\) lines contains three integers \(x\), \(y\), and \(\theta\) separated by spaces.

outputFormat

For each car, output its final coordinates on a separate line. Each line should contain the two integers, separated by a space, written to stdout.

## sample
5
1 2 0
3 4 1
-1 -2 2
5 5 3
0 0 1
2 2

3 5 -2 -2 5 4 0 1

</p>