Cameras

Read n eight-character plates and print each one that matches a fixed pattern of digits and a capital letter, in input order.

Easy2StringImplementationBrute forceInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

A crowded city has a traffic camera at every intersection. Each camera photographs the plate of any car that runs a red light. The enforcement department needs a program that processes all the recorded plates and issues a ticket for every car that broke the law. An image processing module has already read the plates from the recordings into a file, so only the ticketing module is left to write. The trouble is that the image processing module is not perfect, so some of the plates it reports are wrong.

A correct plate satisfies all of the following conditions.

  • It is 8 characters long.
  • The two leftmost characters are the same digit, between 11 and 99. That digit tells which city issued the plate.
  • The next two characters are digits between 11 and 99.
  • The next character is a capital English letter.
  • The three rightmost characters are also digits between 11 and 99.

Input

The first line contains the number of plates nn reported by the image processing module. It holds that 1n10001 \le n \le 1000.

Each of the next nn lines contains one recognized plate. Every such line consists of exactly 8 characters, each a digit or an English letter.

Output

Print the plates that broke the law, one per line, in the order they appear in the input. If the same plate broke the law several times, print it once for each violation. Do not print a wrongly recognized plate, meaning one that fails at least one of the conditions above. If there is nothing to print, print nothing.