274. Spam-filter

time limit per test: 0.25 sec.
memory limit per test: 65536 KB
input: standard
output: standard



After tremendous last-year success not yet well-known, but already grown-up company H&H decided to create a new software masterpiece -- a world-leading spam-filter.
Due to Your poor last year -- a world-leading spam-filter. Due to your poor last year project performance, you are given a small and boring task again.
Your task is to write a simple email-validator.

Valid email address can be described as follows:
<letter> ::= a|b|...|z|A|B|...|Z

<symbol> ::= <letter>|0|1|...|9|_|-
<word> ::= <symbol>|<symbol><word>
<prefix> ::= <word>|<prefix>.<word>
<domain> ::= <letter><letter>|<letter><letter><letter>
<suffix> ::= <prefix>.<domain>
<address> ::= <prefix>@<suffix>

Input
The first line of the input file contains integer number N (1 <= N <= 100) -- the number of email addresses to be checked. Each of the following N lines contains one email address. Email address is the non-empty sequence of characters with ASCII codes from 32 to 255 no more then 100 characters long.

Output
For each address from the input write a separate line with the word YES, if the email address is valid and NO if it is not.

Sample test(s)

Input
3
abc@abc
abc@abc.abc
_@-.ru

Output
NO
YES
YES

Author:Ilya V. Elterman
Resource:ACM ICPC 2004-2005, NEERC, Southern Subregional Contest
Date:Saratov, October 7, 2004