#K42712. Traffic Light Color Determination

    ID: 27149 Type: Default 1000ms 256MiB

Traffic Light Color Determination

Traffic Light Color Determination

At a busy intersection, traffic lights cycle through specific patterns based on the direction of travel.

For the north and south directions, the sequence is as follows:

  • Green for 60 seconds
  • Yellow for 10 seconds
  • Red for the remainder of the cycle

For the east and west directions, the light remains red while north-south is active, then follows this sequence:

  • Green for 60 seconds
  • Yellow for 10 seconds
  • Red for the rest of the cycle

The entire cycle lasts for \( T = 140 \) seconds. Given the direction and the elapsed time (in seconds) since the start of the cycle, determine the current color of the traffic light.

inputFormat

The input consists of two lines:

  1. A string representing the direction of travel. It will be one of: "north", "south", "east", or "west".
  2. An integer representing the elapsed time in seconds since the light turned green (or since the start of the cycle).

You should consider the elapsed time modulo \( T = 140 \) seconds.

outputFormat

Output a single string which is the color of the traffic light. The possible outputs are: "green", "yellow", or "red".

## sample
north
50
green